Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

proc_freq

frequency table as flextable


Description

This function compute a two way contingency table and make a flextable with the result.

Usage

proc_freq(
  x,
  row,
  col,
  main = "",
  include.row_percent = TRUE,
  include.column_percent = TRUE,
  include.table_percent = TRUE,
  include.column_total = TRUE,
  include.row_total = TRUE,
  include.header_row = TRUE,
  weight = NULL
)

Arguments

x

data.frame object

row

characer column names for row

col

characer column names for column

main

characer title

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.column_total

boolean whether to include the row of column totals; defaults to TRUE

include.row_total

boolean whether to include the column of row totals; defaults to TRUE

include.header_row

boolean whether to include the header row; defaults to TRUE

weight

character column name for weight

Author(s)

Titouan Robert

Examples

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

flextable

Functions for Tabular Reporting

v0.6.10
GPL-3
Authors
David Gohel [aut, cre], Clementine Jager [ctb], Quentin Fazilleau [ctb], Maxim Nazarov [ctb] (rmarkdown for docx output), Titouan Robert [ctb], Michael Barrowman [ctb] (inline footnotes), Atsushi Yasumoto [ctb] (support for bookdown cross reference), Paul Julian [ctb] (support for gam objects)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.