proc_freq: Frequency table

View source: R/proc_freq.R

proc_freqR Documentation

Frequency table

Description

This function computes a one or two way contingency table and creates 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,
  include.table_count = 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

include.table_count

boolean whether to include the table counts; defaults to TRUE

weight

character column name for weight

...

unused arguments

Examples

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

flextable documentation built on Oct. 30, 2024, 9:15 a.m.