binarize.y | R Documentation |
Recode a Variable with Two Unique Values into an 0/1 Vector
binarize.y(y, verbose = FALSE)
y |
a vector, must contain two unique values. |
verbose |
a logical value, TRUE or FALSE, indicating whehter details are to be printed on the screen. |
a list with three elements: y
, a vector of the same length as y
, whose entries are coded to 0 and 1, coding.scheme
, a character string describing the map from the original coding to 0/1 coding, and ycode
, a character vector containing the original level names of y
.
y <- factor(c('good', 'bad', 'good', 'good', 'bad')) (yb <- binarize.y(y)) y <- c(TRUE, FALSE, FALSE, FALSE, TRUE) (yb <- binarize.y(y)) y <- c(1, 2, 2, 1, 2) (yb <- binarize.y(y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.