| bc.b | R Documentation |
The bc.b() method
performs broadcasted logical (or Boolean) operations on 2 arrays.
Please note that these operations will treat the input as logical.
Therefore, something like bc.b(1, 2, "==") returns TRUE,
because both 1 and 2 are TRUE when treated as logical.
For regular relational operators, see bc.rel.
bc.b(x, y, op, ...)
## S4 method for signature 'ANY'
bc.b(x, y, op)
x, y |
conformable vectors/arrays of type |
op |
a single string, giving the operator. |
... |
further arguments passed to or from methods. |
Normally:
A logical array/vector as a result of the broadcasted Boolean operation.
If both x and y are type of raw:
A raw array/vector as a result of the broadcasted Boolean operation,
where 01 codes for TRUE and 00 codes for FALSE.
This is convenient as raw requires less memory space than logical.
bc.b(x, x, "nand") and bc.b(x, x, "nor") are equivalent to logical negation of x.
broadcast_operators
x.dim <- c(4:2)
x.len <- prod(x.dim)
x.data <- sample(c(TRUE, FALSE, NA), x.len, TRUE)
x <- array(x.data, x.dim)
y <- array(1:50, c(4,1,1))
bc.b(x, y, "&")
bc.b(x, y, "|")
bc.b(x, y, "xor")
bc.b(x, y, "==")
bc.b(x, y, "!=")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.