report.freqTab: A frequency table with missing values

View source: R/report.freqTab.R

report.freqTabR Documentation

A frequency table with missing values

Description

The function creates a frequency table (with percentages and cumulative percentages) with valid values and with missing values.

Usage

report.freqTab(
  catVarName,
  data,
  dec = 2,
  dec.freq = 0,
  cumulative = FALSE,
  useNA = "always",
  language = "english",
  sort.cat = FALSE,
  total.row = TRUE
)

Arguments

catVarName

The name of a categorical variable.

data

A data frame or an object of class survey.design from survey package.

dec

Number of decimal places for percentages. Default is 2.

dec.freq

Number of decimal places for frequencies. Defaults is 0. Only used when an object of class survey.design is specified with the parameter data.

cumulative

Wheter to report cumulative frequencies and percentages or not. Default is FALSE.

useNA

Wheter to include NA values in the table. Default is always (it includes NAs even when the count of NAs is zero), other ppossible values are no (do not include NAs) and ifany (NAs are included if they are present in the data). See ?table for more.

language

The language used for displaying the statistics in the frequency table. This parameter accepts two values: english or slovene. Depending on the chosen language, all statistical terms and output will be adjusted accordingly. Default is english.

sort.cat

A logical or character value that specifies whether and how the categories of the frequency table should be sorted. If FALSE (the default), the categories are not sorted and appear in the order they are found in the data. If "freq", the categories are sorted by frequency in descending order (most frequent categories first).

total.row

Logical; if 'TRUE', adds a total row at the bottom of the frequency table. Default is TRUE.

Note

This is a modified function freqTab from the package multiUS. The author of the original function is Aleš Žiberna.

Author(s)

Marjan Cugmas

Examples

report.freqTab(catVarName = "gear", dec = 2, useNA = "always", data = mtcars)

handyReport documentation built on Oct. 8, 2024, 3 p.m.