util_bar_plot {dataquieR} | R Documentation |
Utility function to create bar plots
Description
A helper function for simple bar plots. The layout is intended for data with positive numbers only (e.g., counts/frequencies).
Usage
util_bar_plot(
plot_data,
cat_var,
num_var,
relative = FALSE,
show_numbers = TRUE,
fill_var = NULL,
colors = "#2166AC",
show_color_legend = FALSE,
flip = FALSE
)
Arguments
plot_data |
the data for the plot. It should consist of one column
specifying the categories, and a second column giving the
respective numbers / counts per category. It may contain
another column to specify the coloring of the bars
( |
cat_var |
column name of the categorical variable in |
num_var |
column name of the numerical variable in |
relative |
if |
show_numbers |
if |
fill_var |
column name of the variable in |
colors |
vector of colors, or a single color |
show_color_legend |
if |
flip |
if |
Value
a bar plot