Learn R Programming

healthcareai (version 1.2.4)

isBinary: Check if a vector has only two unique values.

Description

Check if a vector is binary (not counting NA's)

Usage

isBinary(v)

Arguments

v

A vector, or column of values

Value

A boolean

References

http://healthcareai-r.readthedocs.io

See Also

healthcareai

Examples

Run this code
# NOT RUN {
isBinary(c(1,2,NA))
isBinary(c(1,2,3))
# }

Run the code above in your browser using DataLab