is.incalogical: Coerce to logical if value is logical according to INCA

Description Usage Arguments Details Value Examples

View source: R/is.incalogical.R

Description

Boolean vectors in INCA are stored internally as 0/1 and are changed to "True"/blank when exported. These functions identify such a variable as Boolean and can coerce it to such.

Usage

1
2
3

Arguments

x

vector (potentially logical)

Details

It is common that check boxes are blanks by default but that this should be interpreted as TRUE. There are however some uncommon cases were the boxes are marked with "False" for FALSE. We can therefore not be certain of the meaning of a blank value. These will therefore be treated as NA.

Value

is.incalogical returns TRUE if the vector is logical according to INCA:s internal rules, FALSE otherwise. incalogical2logical returns a logical vector if x can be coerced to such.

Examples

1
2
3
4
is.incalogical(c("", "", "True", ""))  # TRUE
is.incalogical(c("", "False", "", "")) # TRUE
is.incalogical(c("", "FALSE", "", "")) # FALSE
is.incalogical(logical(2)) # will be recognised as well

incadata documentation built on April 14, 2020, 6:08 p.m.