Description Usage Arguments Details Value Examples
View source: R/utilities-data-validation.R
Utility function to verify that a variable is dichotomous.
1 | makeLogical(x)
|
x |
Vector containing two unique types of values. |
This function effectively allows the user to ask for any variable containing at most two unique values to treat the variable as logical. If the variable contains numeric values, the highest value is recoded 1 and the the lower value is recoded 0. If the variable is categorical and contains only two unique values, the least frequently observed is recoded 1.
Logical form of x
coded 0-1.
1 2 3 | makeLogical(sample(c('cat', 'dog'), size=8, replace=TRUE))
makeLogical(sample(c(0, 1), size=8, replace=TRUE))
makeLogical(sample(c(-6.87, 3.23), size=8, replace=TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.