Learn R Programming

naaccr (version 3.1.1)

naaccr_boolean: Interpret NAACCR-style booleans

Description

Interpret NAACCR-style booleans

Usage

naaccr_boolean(flag, false_value = c("0", "1"))

Value

A logical vector with the interpreted values of flag. Any original values not seen as TRUE or FALSE are converted to NA.

Arguments

flag

Character vector of flags.

false_value

The flag value to interpret as FALSE. If "0" (default), then "1" is interpreted as TRUE. If "1", then "2" is interpreted as TRUE.

Examples

Run this code
  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