tests/testthat/test-slice-assign.R

test_that("can get identical results with slice assign and subset assign", {
  x <- array(1:8, c(2, 2, 2))
  expect <- x

  rray_slice(x, 1, 2) <- 1
  rray_subset(expect, , 1) <- 1

  expect_equal(x, expect)

  rray_slice(x, 2, 3) <- matrix(1:2, nrow = 1)
  rray_subset(expect, , , 2) <- matrix(1:2, nrow = 1)

  expect_equal(x, expect)
})

Try the rray package in your browser

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

rray documentation built on July 23, 2019, 5:04 p.m.