Use a modality for TRUE and onther for FALSE

to_logical(x, true = TRUE, false = FALSE)

Arguments

x

character vector

true

character, modality for TRUE

false

character, modality for FALSE

Value

logical vector

Author

Victor Champonnois et Frédéric Grelot

Examples

x = sample(c("red", "blue"), 10, replace = TRUE)
floodam.data:::to_logical(x, "red", "blue")
#>  [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE
floodam.data:::to_logical(x, "red", "green")
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE   NA TRUE TRUE TRUE