SummarizeVar: Summarize a vector (continuous or factor)

Description Usage Arguments Value Author(s) References

View source: R/demographics.R

Description

Summarize a continuous or discrete (factor) vector.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SummarizeVar(
  x,
  group = rep(1, length(x)),
  latex = TRUE,
  decimalFactor = 0,
  decimalContinuous = 2,
  ContinuousSummaryFunction = SummarizeContinuousDefault,
  FactorSummaryFunction = SummarizeFactorDefault,
  ...
)

Arguments

x

Vector of values.

group

Group identifiers to return summaries by group.

latex

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

decimalFactor

The number of decimals to display in percentages for factor variables. This is passed to the decimal in factor.summary.function.

decimalContinuous

The number of decimals to display in percentages for numeric variables. This is passed to the decimal in ContinuousSummaryFunction.

ContinuousSummaryFunction

Function to use to summarize a continuous variable; defaults to SummarizeContinuousDefault. Function must take in the following arguments: x: a vector of values. group: a vector that identifies group. decimal: a numeric value to indicate the decimal places in the formatted output. latex: a logical value that indicates whether the resulting output contains LaTeX code; should default to TRUE. ...: additional arguments.

FactorSummaryFunction

Function to use to summarize a factor variable; defaults to SummarizeFactorDefault. See ContinuousSummaryFunction.

...

Arguments to be passed to ContinuousSummaryFunction and FactorSummaryFunction.

Value

Formatted text in a vector or matrix.

Author(s)

Vinh Nguyen

References

This function was borrowed (and modified) from Vinh Nguyen's day2day package.


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