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.

is.incalogical(x)

incalogical2logical(x)

Arguments

x

vector (potentially logical)

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.

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.

Examples

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