Categories-class {crunch}R Documentation

Categories in CategoricalVariables

Description

CategoricalVariables, as well as the array types composed from Categoricals, contain Categories. Categories are a subclass of list that contains only Category objects. Category objects are themselves subclasses of lists and contain the following fields:

Usage

Categories(..., data = NULL)

Category(..., data = NULL)

Arguments

...

Category attributes

data

For the constructor functions Category and Categories, you can either pass in attributes via ... or you can create the objects with a fully defined list representation of the objects via the data argument. See the examples.

Examples

cat.a <- Category(name = "First", id = 1, numeric_value = 1, missing = FALSE)
cat.b <- Category(data = list(name = "First", id = 1, numeric_value = 1, missing = FALSE))
identical(cat.a, cat.b)
cat.c <- Category(name = "Second", id = 2)
cats.1 <- Categories(cat.a, cat.c)
cats.2 <- Categories(data = list(cat.a, cat.c))
identical(cats.1, cats.2)

[Package crunch version 1.30.1 Index]