categorize function

A table function to use with magrittr pipes

A table function to use with magrittr pipes

Accepts a data frame as input and computes a contingency table for direct use in combination with the magrittr package.

categorize(.data, ...)

Arguments

  • .data: A data frame
  • ...: A formula (as in xtabs) or one or more objects which can be interpreted as factors (including character strings), or a list (or data frame) whose components can be so interpreted.

Returns

A table (possibly as an xtabs class if a model formula was used)

Details

categorize is a wrapper to xtabs or table such that a data frame can be given as the first argument.

Examples

if (requireNamespace("magrittr", quietly = TRUE)) { library(magrittr) esoph %>% categorize(alcgp, agegp) esoph %>% categorize(~ alcgp + agegp) }

Author(s)

Claus Ekstrom claus@rprimer.dk

  • Maintainer: Claus Thorn Ekstrøm
  • License: GPL-2
  • Last published: 2023-08-20