Learn R Programming

nomiShape (version 1.0.0)

ranked_barplot: Ranked Bar Plot for Nominal Variables

Description

Creates a bar plot for a nominal variable, with categories ordered from most frequent to least frequent.

Usage

ranked_barplot(df, var, scale = c("count", "percent"), title = NULL)

Value

A ggplot2 object representing the ranked bar plot.

Arguments

df

A data.frame or tibble containing the variable.

var

Character string giving the name of the variable in df.

scale

Character; either "count" (default) or "percent".

title

Optional character string specifying the plot title.

Examples

Run this code
ranked_barplot(categories, "animal")
ranked_barplot(categories, "animal", scale = "percent")

Run the code above in your browser using DataLab