View source: R/psychometrics.R
re_code | R Documentation |
Recode specified values by new values
re_code(x, from, to)
x |
A vector, including column of data frame |
from |
The set of old values to be replaced by new ones |
to |
The set of new values to replace the old ones |
A vector that is the input vector but with old values replaced by new ones.
# Replace any occurrence of 1 and 2 with 101 and 201, respectively
x <- c(1, 2, 3, 4, 5, 1, 2)
re_code(x, from = c(1, 2), to = c(101, 201))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.