ffreqtable: Fast Frequency Tables Creates frequency tables for an...

View source: R/ffreqtable.R

ffreqtableR Documentation

Fast Frequency Tables Creates frequency tables for an arbitrary number of variables. It can return them as a list, write them to an arbitrary folder on disk as CSV files (with an optional prefix or return kable tables that are designed to work well with render() and LaTeX. It is based on data.table and is therefore capable of quickly processing massive data sets.

Description

To show the kable output in render() you must add the following chunk option: "results = 'asis'"

Usage

ffreqtable(
  x,
  varlist = names(x),
  sumrow = TRUE,
  out.list = TRUE,
  out.kable = FALSE,
  out.csv = FALSE,
  out.dir = "./",
  prefix = "",
  align = "r"
)

Arguments

x

A data.frame or data.table.

varlist

(Optional) Character. A vector of variable names to construct tables for. Defaults to all variables.

sumrow

(Optional) Logical. Whether to add a summary row. Defaults to TRUE.

out.list

(Optional) Logical. Whether to output the frequency tables as a list. Defaults to TRUE. Returns NULL otherwise.

out.kable

(Optional) Logical. Whether to return kable tables. Defaults to FALSE.

out.csv

(Optional) Logical. Whether to write CSV files (one per variable) to disk. Defaults to FALSE.

out.dir

(Optional) Character. The target directory for writing CSV files. Defaults to the current R working directory.

prefix

(Optional) A string to be prefixed to the filename of each CSV file. Default is not to add a string and just to output the variable name as the name of the CSV file.

align

(Optional) Alignment of table columns passed to kable. Default is "r". Note that your options passed must work for a five-column layout.

Value

Returns a list of frequency tables for each variable by default. Different out.* arguments can add CSV and kable output.


SeanFobbe/databuilder documentation built on July 20, 2022, 4:50 a.m.