ggstatsplot (version 0.1.2)

cat_label_df: Summary dataframe for categorical variables.

Description

Creating a dataframe with an added column corresponding to summary for categorical variables.

Usage

cat_label_df(data, label.col.name = "slice.label",
  label.content = "percentage", label.separator = c("\n", " "),
  perc.k = 1)

Arguments

data

A dataframe containing summaries for categorical variables. Should contain columns named either "perc" or "counts" or both.

label.col.name

Character that decides the column name containing summary label. This can either be "slice.label" (default) or "data.label".

label.content

Character decides what information needs to be displayed on the label in each pie or bar slice. Possible options are "percentage" (default), "counts", "both".

label.separator

If "both" counts and proportion information is to be displayed in a label, this argument decides whether these two pieces of information are going to be on the same line (" ") or on separate lines ("\n").

perc.k

Numeric that decides number of decimal places for percentage labels (Default: 0).

Examples

Run this code
# NOT RUN {
# dataframe with label column
ggstatsplot:::cat_label_df(
  data = ggstatsplot:::cat_counter(mtcars, am, cyl),
  label.col.name = "slice.label",
  label.content = "both",
  perc.k = 1
)
# }

Run the code above in your browser using DataCamp Workspace