Learn R Programming

vvconverter (version 0.7.0)

test_01: Test 01

Description

This function tests whether the vector is actually a boolean, but is encoded as a 0/1 variable. The function checks for numeric vectors whether the only occurring values are 0, 1, or NA. At character and factor vectors checks whether the only occurring values are "0", "1", or NA to be. If there is a 0/1 variable, TRUE is returned, in all others cases FALSE.

Usage

test_01(x)

Value

A TRUE/FALSE value on the test

Arguments

x

The vector to test

See Also

Other booleans: transform_01_to_ft()

Examples

Run this code
vector <- c(0, 1, 0, 1, 1, 1, 0)
test_01(vector)

Run the code above in your browser using DataLab