fp_table: One and two-way summaries of frequencies, percentages and...

View source: R/dataFunctions.R

fp_tableR Documentation

One and two-way summaries of frequencies, percentages and totals.

Description

One and two-way summaries of frequencies, percentages and totals.

Usage

fp_table(
  .data,
  colvar,
  rowvar = NULL,
  transpose = FALSE,
  useNA = c("no", "ifany", "always")
)

Arguments

.data

A dataframe or tibble.

colvar

Character string naming the factor variable for tabulation.

rowvar

(Optional) string naming factor the row variable for cross-tabulation.

transpose

Logical specifying whether to transpose the result.

useNA

One of ⁠"no"⁠ (default), ⁠"ifany"⁠ or ⁠"always"⁠ specifying the handling of missing values.

Value

A dataframe containing frequencies and percentages. The columns contain frequecies and row percentages. A two-way summary is produced if rowvar is specified. Rows and columns can be reversed by specifying transpose = TRUE. The result is uglier than a hairless cat, but can easily be converted to useful tabular formats with some custom recoding.

Author(s)

Steve Gutreuter


sgutreuter/SGmisc documentation built on Aug. 25, 2024, 7:21 p.m.