cpf_: *C*umulative *P*ercentile *F*requency Table

Description Usage Arguments Details Value Examples

View source: R/cpf.R

Description

cpf produces a frequency table by the specified variables, which should be categorical and of relatively low cardinality.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cpf_(data, ..., .dots, wt = NULL, sort = TRUE, margin = TRUE,
  chi_square = FALSE, kable = FALSE)

cpf(data, ..., wt = NULL, sort = TRUE, margin = TRUE,
  chi_square = FALSE, kable = FALSE)

has(data, ..., wt = NULL, sort = TRUE, margin = TRUE,
  chi_square = FALSE, kable = FALSE)

has_(data, ..., .dots, wt = NULL, sort = TRUE, margin = TRUE,
  chi_square = FALSE, kable = FALSE)

Arguments

data

A dataframe.

...

Variable names defining table groupings.

.dots

Vector of variable names defining table groupings.

wt

(Optional, character) variable name to use for weighting frequencies.

sort

Logical, whether to sort table in descending frequency. Setting to FALSE will sort table alphabetically by grouping variables.

margin

Logical, whether to add total row to end of table.

chi_square

Logical, whether to print chi-square test (has no effect on one-dimensional tables).

kable

Logical, whether to format table for Rmarkdown.

Details

has is a wrapper around cpf for the common pattern of counting the number of NA and non-NA values in each specified variable. It is equivalent to cpf(data, !is.na(x), !is.na(y), ...).

Value

A dataframe or kable.

Examples

1
2
data(mtcars)
cpf(mtcars, cyl, gear)

rebelrebel04/xplor documentation built on May 27, 2019, 4:01 a.m.