cat_summarise {tabbycat} | R Documentation |
Summarise the values of a numerical variable for each group within a categorical variable
Description
The results are sorted on the values of the categorical variable i.e.
the variable specified with cat
. If this variable is a character
vector it will be sorted alphabetically. If it is a factor it will be
sorted in the order of its levels. This function can be called as either
cat_summarise
or cat_summarize
.
Usage
cat_summarise(
data,
cat,
num,
na.rm = FALSE,
clean_names = getOption("tabbycat.clean_names")
)
cat_summarize(
data,
cat,
num,
na.rm = FALSE,
clean_names = getOption("tabbycat.clean_names")
)
Arguments
data |
A dataframe containing a categorical variable and numerical variable to summarise. |
cat |
The name of a column in |
num |
The name of a column in |
na.rm |
A boolean indicating whether to exclude NAs from the row
results. Note that NAs are **always** ignored in calculating the summary
statistics for |
clean_names |
A boolean indicating whether the column names of the
results tibble should be cleaned, so that any column names produced from
data are converted to snake_case. The default is TRUE, but this can be
changed with |
Value
A tibble showing summary statistics for num
for each group
in cat
.