FlexTable Percentage Table

Share:

Description

Get a FlexTable two-way frequency table. Table contains cell frequencies, cell percentages of the total frequency, cell percentages of row frequencies and cell percentages of column frequencies.

Usage

1
2
3
4
5
freqtable(x, percent_digits = 1, label_na = "Missing",
  label_level = "Level", label_sum = "Sum", label_count = "#",
  label_percent = "%", base100 = TRUE, percent = T, row_percent = T,
  col_percent = T, label_percent_col = "col %",
  label_percent_row = "row %")

Arguments

x

a table object

percent_digits

the desired number of digits after the decimal point for percentages.

label_na

label to use for missing level.

label_level

label to use for level column (only for one way table).

label_sum

label to use for margins.

label_count

label to use for frequencies.

label_percent

label to use for percentages.

base100

wether to multiply percentages by 100.

percent

whether to include cell percentages in the table.

row_percent

whether to include cell percentages of row frequencies in the table.

col_percent

whether to include cell percentages of column frequencies in the table.

label_percent_col

label to use for column frequencies.

label_percent_row

label to use for row frequencies.

Value

a FlexTable object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#
am =  c( "automatic", "manual" )[mtcars$am+1]
carb = paste( mtcars$carb, "carburetor(s)")


my_freq_table = freqtable(table( am, carb ) )
print( my_freq_table )
if( interactive() ) readline("Hit <Return> to see next FlexTable:")


my_freq_table = freqtable(table( am, carb, useNA = "always") )
print( my_freq_table )
if( interactive() ) readline("Hit <Return> to see next FlexTable:")