Binary Vectors
is.binary is used to test if a vector is of binary type, i.e. if a vector contains only 0 and/or 1 values.
is.binary(x)
x |
a vector to be tested. |
is.binary returns TRUE or FALSE depending on whether a vector is of binary type or not.
x1 <- runif(100, 0, 1) x2 <- ifelse(x1 < 0.5, 1, 0) is.binary(x1) is.binary(x2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.