onezero | R Documentation |
Turns Yes/No variables into 1/0 integers
onezero(x)
x |
a character vector |
The input is forced to lowercase and only the first character, the "y" or "n", is used to map to the 1/0 integer values. The function allows for "1" and "0" to be in the character vector as well.
an integer vector
flag <- c("Y", "No", "NO", "no", "n", "YES", "Yes", "yEs", "1", "0")
onezero(flag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.