and0 | R Documentation |
Fast but loose implementations of AND and OR logical operators.
and0(x, y)
x, y |
logical or numerical vectors |
Returns pairwise application of logical operators AND and OR. Vectors are recycled as usual.
A logical vector of length max(length(x), length(y))
with
entries x[1] & x[2]
etc.; each entry of x
or y
is
TRUE
if it is non-zero.
These functions should only be used with well understood vectors, and may not deal with unusual cases correctly.
and0(c(0,1,0), c(1,1,0)) ## Not run: set.seed(1234) x = rbinom(5000, 1, 0.5) y = rbinom(5000, 1, 0.5) # 3 to 4 times improvement over `&` system.time(for (i in 1:5000) and0(x,y)) system.time(for (i in 1:5000) x & y) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.