proc_freq: Frequency table

View source: R/proc_freq.R

proc_freqR Documentation

Frequency table

Description

This function compute a one or two way contingency table and create a flextable from the result.

The function is largely inspired by "PROC FREQ" from "SAS" and was written with the intent to make it as compact as possible.

Usage

proc_freq(
  x,
  row = character(),
  col = character(),
  include.row_percent = TRUE,
  include.column_percent = TRUE,
  include.table_percent = TRUE,
  weight = character(),
  ...
)

Arguments

x

a data.frame object containing variable(s) to use for counts.

row

characer column names for row

col

characer column names for column

include.row_percent

boolean whether to include the row percents; defaults to TRUE

include.column_percent

boolean whether to include the column percents; defaults to TRUE

include.table_percent

boolean whether to include the table percents; defaults to TRUE

weight

character column name for weight

...

unused arguments

Examples

proc_freq(mtcars, "vs", "gear")
proc_freq(mtcars, "gear", "vs", weight = "wt")

davidgohel/flextable documentation built on April 18, 2024, 11:37 a.m.