View source: R/utility_functions.R
binary_transform | R Documentation |
Converts any variable with two possible values to a {0,1} binary variable.
binary_transform(x)
x |
A variable with two possible values. |
A vector with values in {0,1}.
## Convert a variable that takes values 'A' and 'B' to 0 and 1
x <- sample( c('A','B'), size = 10, prob = c(0.5,0.5), replace = TRUE )
print(x);flush.console()
binary_transform( x )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.