powered by
This function builds a bar chart with ggplot2 for a field with checkbox (user can select 2 or more options). Each option is one separated column.
bar_chart_checkbox( data, columns, sucess = "checked", labels = NULL, axis_title = "", fill = "blue", axis_title_axis_size = 22, axis_text_axis_size = 22, data_label_size = 15, sort = TRUE )
a ggplot2 object
dataframe object
character vector. Columns to count.
character scalar. Category indicating the sucess. Defaults to "checked".
character vector.Label of each category. Defaults to NULL.
axis y label. Defaults to "".
bar color. Character scale with hexidecimal color ou named color. Defaults to "blue".
integer scalar. Size of axis labels. Defaults to 22.
integer scalar. Size of values annotated in axis. Defaults to 22.
integer scalar. Size of data labels. Defaults to 15
logical scalar. If TRUE, the are ordered using frequency. Defaults to TRUE.
df <- data.frame( x1 = c("checked", "checked", "unchecked"), x2 = c("checked", "unchecked", "checked") ) bar_chart_checkbox(df, c("x1", "x2"))
Run the code above in your browser using DataLab