inst/tinytest/reorient_vector/test-application.R

# set-up ====
enumerate <- 0L

errorfun <- function(tt) {
  
  if(isFALSE(tt)) stop(print(tt))
}

.as.broadcaster <- broadcast:::.as.broadcaster

# along rows ====
x <- matrix(1, 5, 4)
v <- 1:5
v %orientbc<-% 1L

expect_equivalent(
  x * v,
  .as.broadcaster(cbind(1:5, 1:5, 1:5, 1:5))
)
enumerate <- enumerate + 1L


# along columns ====
x <- matrix(1, 5, 4)
v <- 1:4
v %orientbc<-% 2L

expect_equivalent(
  x * v,
  .as.broadcaster(rbind(1:4, 1:4, 1:4, 1:4, 1:4))
)
enumerate <- enumerate + 1L

Try the broadcast package in your browser

Any scripts or data that you put into this service are public.

broadcast documentation built on Aug. 20, 2026, 9:08 a.m.