bc_dim: Predict Broadcasted Dimensions

View source: R/bc_dim.R

bc_dimR Documentation

Predict Broadcasted Dimensions

Description

bc_dim(x, y) gives the dimensions an array would have, as the result of an broadcasted binary element-wise operation between 2 arrays x and y.

Usage

bc_dim(x, y)

Arguments

x, y

an atomic or recursive array.

Value

Returns an integer vector giving the broadcasted dimension sizes of the result, or the length of the result if its dimensions will be NULL.

Examples

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))

dim(bc.b(x, y, "&")) == bc_dim(x, y)
dim(bc.b(x, y, "|")) == bc_dim(x, y)


broadcast documentation built on Sept. 15, 2025, 5:08 p.m.

Related to bc_dim in broadcast...