cat_desc_stats: Compute absolute and relative frequencies.

Description Usage Arguments Value Examples

View source: R/descriptives.R

Description

cat_desc_stats computes absolute and relative frequencies for categorical data with a number of formatting options.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cat_desc_stats(
  quelle,
  separator = " ",
  return_level = TRUE,
  ndigit = 0,
  groupvar = NULL,
  singleline = FALSE,
  percent = TRUE,
  prettynum = FALSE,
  .german = FALSE
)

Arguments

quelle

Data for computation.

separator

delimiter between results per level, preset as ' '.

return_level

Should levels be reported?

ndigit

Digits for rounding of relative frequencies.

groupvar

Optional grouping factor.

singleline

Put all group levels in a single line?

percent

Logical, add percent-symbol after relative frequencies?

prettynum

logical, apply prettyNum to results?

.german

logical, should "." and "," be used as bigmark and decimal? Sets prettynum to TRUE.

Value

Structure depends on parameter return_level: if FALSE than a tibble with descriptives, otherwise a list with two tibbles with levels of factor and descriptives. If parameter singleline is FALSE (default), results for each factor level is reported in a separate line, otherwise they are pasted. Number of columns for result tibbles is one or number of levels of the additional grouping variable.

Examples

1
2
3
4
cat_desc_stats(mtcars$gear)
cat_desc_stats(mtcars$gear, return_level = FALSE)
cat_desc_stats(mtcars$gear, groupvar = mtcars$am)
cat_desc_stats(mtcars$gear, groupvar = mtcars$am, singleline = TRUE)

wrappedtools documentation built on May 8, 2021, 9:06 a.m.