flextable (version 0.5.11)

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

Examples

Run this code
# NOT RUN {
proc_freq(mtcars, "vs", "gear")
proc_freq(mtcars, "gear", "vs")
proc_freq(mtcars, "gear", "vs", weight = "wt")
proc_freq(mtcars, "gear", "vs", "My title")
# }

Run the code above in your browser using DataLab