powered by
Creates a bar plot for a nominal variable, with categories ordered from most frequent to least frequent.
ranked_barplot(df, var, scale = c("count", "percent"), title = NULL)
A ggplot2 object representing the ranked bar plot.
ggplot2
A data.frame or tibble containing the variable.
Character string giving the name of the variable in df.
df
Character; either "count" (default) or "percent".
"count"
"percent"
Optional character string specifying the plot title.
ranked_barplot(categories, "animal") ranked_barplot(categories, "animal", scale = "percent")
Run the code above in your browser using DataLab