Description Usage Arguments Examples
This function takes a vector original.vector, and converts all values in a vector old.values to the values in a new vector new.values.
1 |
original.vector |
A vector you want to recode |
old.values |
A vector of length M. |
new.values |
A vector of length M. |
others |
An optional value indicating what to convert all values in original.vector that are not found in old.values. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0)
)
x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0),
others = NA
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.