Standardise logical variables

fixlogical(x, output = "logical", categories = c("No", "Yes"))

Arguments

x

a vector of two different types of entries (can be of type factor, integer, logical, or character).

output

a switch to set the desired output format. Defaults to "logical", but can be "character", "binary" or "factor".

categories

output target categories for binary/logical traits harmonization if output is not set to 'logical'.

Value

A vector of harmonized logical values.

Examples

a <- factor(sample(c("ja", "nein"), 10, replace = TRUE)) b <- sample(0:1, 20, replace = TRUE) d <- sample(c("Y", "N"), 13, replace = TRUE) d[c(3,7)] <- NA e <- sample(c(TRUE, FALSE), 18, replace = TRUE) fixlogical(c(e,d))
#> [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE FALSE TRUE #> [13] FALSE TRUE FALSE TRUE TRUE FALSE TRUE TRUE NA FALSE TRUE TRUE #> [25] NA FALSE TRUE TRUE FALSE TRUE FALSE