binarize.y {bsnsing} | R Documentation |
Recode a Variable with Two Unique Values into an 0/1 Vector
Description
Recode a Variable with Two Unique Values into an 0/1 Vector
Usage
binarize.y(y, verbose = FALSE)
Arguments
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. |
Value
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
.
Examples
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))
[Package bsnsing version 1.0.1 Index]