freq_by: Frequencies and percentages

Description Usage Arguments Details Examples

Description

freq_by creates frequency and percentage tables in HTML.

Usage

1
2
3
4
5
6
freq_by(dataset, var_vector, by_group = NULL, include_total = TRUE,
  min_cell_count = 10, htmlout = TRUE,
  font_css = "font-family: monospace;", include_p_value = FALSE,
  decimal_percent = 0, include_n = TRUE, include_percent = TRUE,
  include_cumpct = FALSE, include_cumsum = FALSE,
  include_subtotal = FALSE, include_n_missing = FALSE)

Arguments

dataset

A dataset

var_vector

A character vector containing names of the columns in the dataset to calculate frequencies and percentages for.

by_group

A string referring to a factor column in the dataset by which to stratify the calculations.

include_total

whether to include two extra columns of marginal frequencies and percentages, i.e. not stratified by the by_group.

min_cell_count

a number which defaults to 10. Used to preserve anonymity in case of sensitive data. In cells with <= 10 observations, the string "<=10" is printed.

htmlout

Whether to output to html (default and intended usage), or as r-dataframe.

font_css

A string of CSS code defining the font used for the table. Default is'font-family: monospace;'.

include_p_value

logical. Wheather to do base::chisq.test on the combination of by_group and each individual column referred to in var_vector.

decimal_percent

numeric. NUmber of decimals on the calculated percentages.

include_n

logical. Whether to include counts for each group.

include_percent

logical. Whether to include percentages.

include_cumpct

logical. Whether to include cumulative percentages.

include_cumsum

logical. Whether to include cumulative frequencies.

include_subtotal

logical. Whether to include subtotals.

include_n_missing

logical. Whether to include number of missing in each group.

Details

The output is a table in HTML which can be viewed in a browser or included in a knitr-report.

Examples

1
2
3
# Outputs HTML:
output <-
epitable::freq_by(example_data, c("cut", "color"), "clarity", htmlout = FALSE, min_cell_count = 30)

rasmusrhl/epitable documentation built on May 30, 2019, 7:04 p.m.