View source: R/plot_results_bargraph.R
plot_results_bargraph | R Documentation |
This function takes a single variable result from a dataframe of results produced by healthyr::analyse_survey_results and creates a bar chart with confidence intervals. If specified can also produce grouped bar charts. Intended for use on already aggregated results, uses stat = "identity".
plot_results_bargraph(
results_df,
col_results,
var_to_plot,
var_to_group,
file_path = NULL,
wdth = NULL,
hght = NULL,
title_name = NULL
)
results_df |
Inputs a dataframe of results produced from the healthyr::analyse_survey_results function. |
col_results |
Inputs a character vector of column names that are formatted as results with CIs in square brackets. |
var_to_plot |
Inputs a character value specifying the variable to plot. |
var_to_group |
Inputs a character value specifying the variable to group by, for grouped bar charts. |
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. |
Returns a ggplot2 object.
## Not run: plot_results_bargraph(results_df, col_results = c(names(df[,-1]),
var_to_plot = "gam_wfhz_noflag", var_to_group = "admin2") ))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.