naaccr_boolean: Interpret NAACCR-style booleans

View source: R/data-item-interpreting.R

naaccr_booleanR Documentation

Interpret NAACCR-style booleans

Description

Interpret NAACCR-style booleans

Usage

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

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.

Value

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

Examples

  x <- c("0", "1", "2", "9", NA)
  naaccr_boolean(x)
  naaccr_boolean(x, false_value = "1")

naaccr documentation built on Nov. 23, 2022, 5:06 p.m.