Skip to contents

Add codes to a vector of labels

Usage

as.cfactor(x, codes = NULL, ordered = is.ordered(x))

# S3 method for class 'factor'
as.cfactor(x, codes = NULL, ordered = is.ordered(x))

as.cordered(x, codes = NULL)

Arguments

x

a vector of values representing labels for factor levels

codes

named vector of unique codes that declares the mapping of labels to codes

ordered

logical flag to determine if the codes should be regarded as ordered (in the order given).

Value

a new cfactor