Description Usage Arguments Details Value Examples
View source: R/gg_prop_var_by_demographics.R
Function accepts target variables and demographic variables (factorial variables) and calculates the proportions of the target variable in the demographic variable cut. The function produces a bar chart of the target variable proportion as a demographic variable function.
1 2 3 4 5 6 | gg_prop_var_by_demographics(
x,
target_variable,
demographics = vars(...),
arrange_desc = T
)
|
x |
a tbl() with the data. |
target_variable |
Target variable on which the demographic cuts will be made. |
demographics |
Demographics variables. The variables' levels affect ordering on the x axis |
arrange_desc |
Logical. arrange parameter. |
Use '$' to generate the desired graph. See example.
Function accepts target variables and demographic variables (factorial variables) and calculates the proportions of the target variable in the demographic variable cut. The function produces a bar chart of the target variable proportion as a demographic variable function.
1 2 3 4 5 6 7 8 9 10 11 | quality_assurance <- data.frame(
product_color = sample(c("Red", "Green", "Blue", "Orange"), size = 50, replace = T),
status = sample(c("pass", "fail"), size = 50, replace = T),
product_name = sample(c("Lea", "Rose", "Ruth"), size = 50, replace = T))
quality_assurance_plot <- gg_prop_var_by_demographics(quality_assurance,
target_variable = product_name,
demographics = vars(product_color, status))
quality_assurance_plot$product_color
quality_assurance_plot$status
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.