freqTable: Frequency table of the number of times of individual value...

Description Usage Arguments Value Examples

View source: R/freqTable.R

Description

Frequency table of the number of times of individual value occurs

Usage

1
2
freqTable(dt_data, v_s_vars, b_total_row = FALSE, b_include_perc = FALSE,
  s_order_by = "v_s_vars")

Arguments

dt_data

a data.table.

v_s_vars

a character vector of column names in dt_data.

b_total_row

default FALSE, whether we include a row with the total amount of values.

b_include_perc

default FALSE, whether we include a column with percentages.

s_order_by

default "v_s_vars". How the output data.table should be ordered. If "v_s_vars", ordered by values of parameter. If "ascending", ordered by ascending frequency. If "descending", ordered by "descending" frequency.

Value

A data.table with the number of times an individual value occurs

Examples

1
2
3
4
5
6
7
8
library(data.table)
dt_data <- data.table( var1 = c(1,1,2,2,3,3,3,3),
                       var2 = c(6,6,6,7,7,7,7,7))
freqTable(dt_data, "var1", b_total_row = TRUE)
freqTable(dt_data, c("var1","var2"), b_include_perc = TRUE)
freqTable(dt_data, c("var1","var2"), b_include_perc = TRUE, s_order_by = "descending" )
freqTable(dt_data, c("var1","var2"), b_total_row = TRUE,
          b_include_perc = TRUE, s_order_by = "descending")

AlejandroKantor/akmisc documentation built on May 5, 2019, 3:51 a.m.