powered by
Detects if a vector (after removing NAs) contains only 0 and 1.
is_scored_01(vec)
TRUE if the vector is 0/1 scored, FALSE otherwise.
The vector to check.
is_scored_01(c(1, 0, 1, 0, NA)) is_scored_01(c(1, 0, 2, 0)) is_scored_01(c("A", "B", "C"))
Run the code above in your browser using DataLab