Learn R Programming

fifer (version 1.1)

SummarizeFactorDefault: Summarize a factor vector with count and percentages

Description

Summarize a factor variable with count and percentages.

Usage

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.

Value

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

Details

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

Examples

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

Run the code above in your browser using DataLab