Implies | R Documentation |
Implies
Implies(x, y, anyNAx = TRUE, anyNAy = TRUE)
x, y |
Logical vectors of equal length. |
anyNAx, anyNAy |
Whether |
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.