Learn R Programming

questionr (version 0.7.7)

ltabs: Cross tabulation with labelled variables

Description

This function is a wrapper around xtabs, adding automatically value labels for labelled vectors if labelled package eis installed.

Usage

ltabs(
  formula,
  data,
  levels = c("prefixed", "labels", "values"),
  variable_label = TRUE,
  ...
)

Arguments

formula

a formula object (see xtabs)

data

a data frame

levels

the desired levels in case of labelled vector: "labels" for value labels, "values" for values or "prefixed" for labels prefixed with values

variable_label

display variable label if available?

...

additional arguments passed to xtabs

See Also

Examples

Run this code
data(fecondite)
ltabs(~radio, femmes)
ltabs(~radio+tv, femmes)
ltabs(~radio+tv, femmes, "l")
ltabs(~radio+tv, femmes, "v")
ltabs(~radio+tv+journal, femmes)
ltabs(~radio+tv, femmes, variable_label = FALSE)

Run the code above in your browser using DataLab