SummarizeFactorDefault: Summarize a factor vector with count and percentages

Description Usage Arguments Details Value Author(s) Examples

View source: R/demographics.R

Description

Summarize a factor variable with count and percentages.

Usage

1
2
3
4
5
6
7
8
SummarizeFactorDefault(
  x,
  group = rep(1, length(x)),
  decimal = 0,
  latex = TRUE,
  useNA = "ifany",
  ...
)

Arguments

x

Vector of values.

group

Group identifier to return summaries by group.

decimal

The number of decimal values to format the results; defaults to 0.

latex

Return LaTeX characters if TRUE (default). For example, the LaTeX code for the percentage symbol should be preceeded by the escape character }.

useNA

Defaults to ifany and passed to table.

...

Nothing.

Details

Default factor.summary.function for use in SummarizeVar. Returns formatted text of count and percentages. For use in construction of demographics tables.

Value

Formatted text of counts with percentages in parentheses, in a vector or matrix.

Author(s)

Vinh Nguyen

Examples

1
2
SummarizeFactorDefault(x=c(sample(1:5, 100, replace=TRUE), sample(1:5, 100, replace=TRUE)), 
  group=rep(0:1, each=100))

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.