recode | R Documentation |
Assign new values to a vector.
recode(x, old, new, must.match = FALSE)
x |
A vector whose values will be recoded, can be character, numeric, or factor. |
old |
A vector of the unique values currently in the vector. |
new |
A vector of values which should replace the current ones. |
must.match |
A logical scalar indicating whether only those elements of
the original vector with values in |
A vector the same length as x
(unless must.match=TRUE
),
with old
values replaced by new
values.
recode(c(1,1,1,2,3,4,1,10,3), 1:3, 1001:1003) recode(c(1,1,1,2,3,4,1,10,3), 1:3, 1001:1003, must.match=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.