Description Usage Arguments Details Value Author(s) References See Also Examples
Systematically substitute specific values from one set using corresponding values from another set.
1 |
x |
vector |
from |
vector (elements usually unique) |
to |
vector with same length as |
strict |
whether to set unmapped values to |
... |
ignored |
Occasionally one wants to recode a set of categories using some other idiom.
factor supports recoding by creative use of the arguments levels
and labels. However, the result is a factor, and may need more
transformation. Furthermore, factor allows one-to-one reclassification
but not many-to-one reclassification (repeated levels is not supported; i.e., it
is not directly possible to collapse two levels to a single replacement code).
Here, from is the discrete set of values we expect in x, and
to is the element-wise corresponding values with which we wish to re-present
elements in x. Values in x not found in from will be normally
represented as NA (which is itself a legitimate value for to). However,
if strict=FALSE, map tries to preserve un-mapped values.
It is an
error if from and to have different lengths.
vector of same class as to and same length as x
Tim Bergsma
http://metrumrg.googlecode.com
match
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.