add_labels: Add extra labels to categories

Description Usage Arguments Examples

Description

Add extra labels to categories

Usage

1

Arguments

x

categorical

...

named labels in same order as categories(x)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# create a random sample of states
state <- sample(state.abb, 10, replace=TRUE)

# coerce it to a categorical vector
state <- categorical(state, levels=state.abb)

# add extra information of states
state <- add_labels(state, name=state.name, region=state.region, division=state.division)

categories(state)
labels(state, "region")

state2 <- relabel(state, "name")
state2
categories(state2)

edwindj/category documentation built on May 15, 2019, 11:04 p.m.