convertclass | R Documentation |
convertclass
converts a binary variable with any
response into 1/0 response. It is used internally in other functions of
package ROCit.
convertclass(x, reference = NULL)
x |
A vector of exactly two unique values. |
reference |
The reference value. Depending on the class of |
A numeric vector of 1 and 0. Gives warning if there exists NA
(s)
in x
.
convertclass
is used internally in other function(s) of ROCit.
x <- c("cat", "cat", "dog", "cat")
convertclass(x) # by default, "cat" is converted to 0
convertclass(x, reference = "dog")
# ----------------------------
set.seed(10)
x <- round(runif(10, 2, 3))
convertclass(x, reference = 3)
# numeric reference can be supplied as character
convertclass(x, reference = "3") # same result
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.