IsDichotomous | R Documentation |
Test if a variable contains only two values. The variable does not need to be a numerical value, factors and logicals are supported as well. NA
s can be skipped by setting na.rm
to TRUE
.
IsDichotomous(x, strict = FALSE, na.rm = FALSE)
Flags(x, na.rm = FALSE)
x |
a numeric or integer vector, a logical vector or a factor (ordered and unordered) |
strict |
logical. If set to |
na.rm |
logical, indicating whether |
IsDichotomous tests a single variable. Flags returns the names of all the dichotomous variables in a list or data.frame.
TRUE
if x
contains only two unique values, FALSE
else
Andri Signorell <andri@signorell.net>
IsDichotomous(sample(10, 5, replace=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.