i_table {ilabelled} | R Documentation |
cross tabulation and table creation using i_labelled labels
Description
wrapper for base::table
convert i_labelled objects to base class and pass to table function
Usage
i_table(..., missing_to_na = TRUE, as_factor = TRUE, table_args = NULL)
Arguments
... |
one or more atomic vectors or one data.frame |
missing_to_na |
make as missing declared values NA |
as_factor |
make labelled data factor before pass to table |
table_args |
arguments of base::table as named list |
Value
returns a contingency table, an object of class "table"
Examples
set.seed(1234)
a <- sample(c(1:3, NA), 10, replace = TRUE)
b <- i_labelled(sample(c(1:3, NA), 10, replace = TRUE), labels = c("A" = 1, "B" = 2, "C" = 3))
c <- factor(sample(c("X", "Y", "Z", NA), 10, replace = TRUE))
df <- data.frame(a, b, c)
i_table(a, b)
i_table(df, table_args = list(useNA = "ifany"))
[Package ilabelled version 0.9.0 Index]