Last data update: 2014.03.03

R: Frequency Tables for Factors and other Discrete Data
freqR Documentation

Frequency Tables for Factors and other Discrete Data

Description

Displays frequencies as well as valid/missing observation information.

Usage

freq(x, round.digits=2, style="simple", justify="right",
     plain.ascii=TRUE, file=NA, append=FALSE,
     escape.pipe=FALSE, ...)

Arguments

x

Vector of discrete (categorical) data.

round.digits

Number of sig. digits to keep in output. Defaults to 2.

style

Style of pander tables, one of “simple” (default), “multiline”, “grid” and “rmarkdown”.

justify

pander argument. Defaults to "right".

plain.ascii

pander argument; when results are displayed in console, this avoids having markdown markup characters int the tables. Defaults to TRUE.

file

File name to write output to. Defaults to NA. To append output to an existing text file, use append=TRUE.

append

When “file” argument is supplied, this indicates whether to append output to existing file (TRUE) or to overwrite any existing file (FALSE, default). If TRUE and no file exists, a new file will be created.

escape.pipe

Only useful when style='grid' and file argument is not NA, in which case it will escape the pipe character (|) to allow Pandoc to correctly convert multiline cells.

...

Additional arguments passed to pander.

Value

A frequency table of class matrix.

Author(s)

Dominic Comtois <dominic.comtois@gmail.com>

References

https://github.com/dcomtois/summarytools

Examples

  data(smokers)
  freq(smokers$gender)
  freq(smokers$gender, style="rmarkdown")

Results