| Implies {hutilscpp} | R Documentation |
Implies
Description
Implies
Usage
Implies(x, y, anyNAx = TRUE, anyNAy = TRUE)
Arguments
x, y |
Logical vectors of equal length. |
anyNAx, anyNAy |
Whether |
Value
Logical implies: TRUE unless x is TRUE and y is FALSE.
NA in either x or y results in NA if and only if the result is unknown.
In particular NA %implies% TRUE is TRUE and FALSE %implies% NA is TRUE.
If x or y are length-one, the function proceeds as if the length-one vector were recycled
to the length of the other.
Examples
library(data.table)
CJ(x = c(TRUE,
FALSE),
y = c(TRUE,
FALSE))[, ` x => y` := Implies(x, y)][]
#> x y x => y
#> 1: FALSE FALSE TRUE
#> 2: FALSE TRUE TRUE
#> 3: TRUE FALSE FALSE
#> 4: TRUE TRUE TRUE
# NA results:
#> 5: NA NA NA
#> 6: NA FALSE NA
#> 7: NA TRUE TRUE
#> 8: FALSE NA TRUE
#> 9: TRUE NA NA
[Package hutilscpp version 0.10.5 Index]