Learn R Programming

crunch (version 1.26.0)

Categories-class: 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: "name", "id", "numeric_value", "missing", and optionally "selected".

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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab