centered_barplot: Centered Frequency Bar Plot for Nominal Variables
Creates a centered bar plot for discrete nominal variables by placing the
most frequent category at the center and progressively less frequent
categories alternately to the left and right.
Description
Centered Frequency Bar Plot for Nominal Variables
Creates a centered bar plot for discrete nominal variables by placing the
most frequent category at the center and progressively less frequent
categories alternately to the left and right.
Usage
centered_barplot(df, var, title = NULL, scale = c("count", "percent"))
Value
A ggplot2 object.
Arguments
df
A data frame containing the nominal variable.
var
A character string giving the name of the nominal variable in df.
title
Optional character string specifying the plot title.
scale
Character string specifying the scale of the frequencies:
"count" (default) for raw counts or "percent" for percentages.