This function takes a dataset and produces a bar plot that visualizes the proportion of responses for different risk behavior variables in relation to suicide attempt status. It allows customization of plot titles and fill colors.

plot_risk_behaviors(
  data,
  behavior_vars,
  suicide_var,
  plot_title,
  fill_colors = c("#24bccb", "#4e2d86")
)

Arguments

data

A dataframe containing the variables of interest.

behavior_vars

A character vector of column names in 'data' representing different risk behaviors.

suicide_var

The name of the column in 'data' that indicates suicide attempt status.

plot_title

Title for the plot.

fill_colors

A character vector of length 2 providing the colors to use for the bars in the plot. Default colors are set to "#24bccb" and "#4e2d86".

Value

A ggplot object representing the bar plot.