A code vector is a vector with an associated code list. The values in the
vector should come from this code list. The values also have an associated
label and optionally additional properties such as a description. See
codelist for more information on what should and could be in a
code list.
Usage
code(x, codelist, ...)
Value
Returns an object of type 'code'. Except when x is a factor, x
keeps classes and attributes assiated with x. This object is a copy of
x with a codelist attribute added.
When x is a factor x it converted to an integer vector. The
labels are the levels of the factor.
Arguments
x
vector to convert to code vector
codelist
code list to associate with the values in x. This
should be convertable to codelist using
as.codelist.
...
Ignored; used to pass extra arguments to other methods
Details
When codelist is omitted when case x is a factor, a code list is
generated from the factor values.