prepare_by_group_bar_graph: Prepares a by Group Bar Graph
Description
Reads a data frame containing a grouping factor and a numerical variable
and plots a bar graph of a given statistic of the variable
by the grouping factor.
Usage
prepare_by_group_bar_graph(
df,
by_var,
var,
stat_fun = mean,
order_by_stat = FALSE,
color = "red"
)
Arguments
df
Data frame containing the grouping factor and the numerical variable
to be plotted
by_var
a string containing the column name of the grouping factor
var
a string containing the column name of the numerical variable
stat_fun
a function to be called on the numerical variable.
Will be called with na.rm = TRUE to ignore missing values
order_by_stat
a logical value indicating whether you want your bars to be ordered
the value of the statistic (defaults to FALSE)