R: Coerce to logical if value is logical according to INCA

is.incalogical {incadata} | R Documentation

## Coerce to logical if value is logical according to INCA

### 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

    is.incalogical(x)

    incalogical2logical(x)

### 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

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

[Package incadata version 0.6.4 Index]