powered by
Interpret NAACCR-style booleans
naaccr_boolean(flag, false_value = c("0", "1"))
A logical vector with the interpreted values of flag. Any original values not seen as TRUE or FALSE are converted to NA.
logical
flag
TRUE
FALSE
NA
Character vector of flags.
The flag value to interpret as FALSE. If "0" (default), then "1" is interpreted as TRUE. If "1", then "2" is interpreted as TRUE.
"0"
"1"
"2"
x <- c("0", "1", "2", "9", NA) naaccr_boolean(x) naaccr_boolean(x, false_value = "1")
Run the code above in your browser using DataLab