plot_domain_distribution: Plot Select Multiple Across Domains

View source: R/plot_domain_distribution.R

plot_domain_distributionR Documentation

Plot Select Multiple Across Domains

Description

This functions plots a count distribution of responses for a select multiple question and shows their responses distributed against some domain categorization of those response. E.g A health barriers question with several response options, however those response options can be grouped by barriers related to availability, accessibility, or quality of services. Each response option should only belong to one domain category.

Usage

plot_domain_distribution(
  df,
  domain_vars,
  response_vars,
  file_path = NULL,
  wdth = NULL,
  hght = NULL,
  title_name = NULL
)

Arguments

df

Inputs a dataframe.

domain_vars

Inputs a character vector of column names for domain categories. Each domain should have its own column coded as 1/0.

response_vars

Inputs a character vector of column names for response categories for the select multiple question coded as 1/0.

file_path

Inputs an optional character value specifying the file path location to save an image of the plot. Recommended to specify as a .jpg or .png file.

wdth

Inputs an optional numeric value for the width of the image.

hght

Inputs an optional numeric value fo the height of the image.

title_name

Inputs an optional character value for the title of the plot.

Value

Returns a ggplot2 object.

Examples

## Not run: plot_domain_distribution(df, domain_vars = c("availability",
"accessibility", "quality"), response_vars = c("barrier.distance",
"barrier.nostaff", "barrier.costtransport", "barrier.rudestaff"))
## End(Not run)

SaeedR1987/healthyr documentation built on July 4, 2023, 11:17 p.m.