tests/testthat/test-sub.R

p <- array(rnorm(27), rep(3,3))

test_that("subtable works", {
  expect_identical(subtable(p, 1:2, list(1,1)), p[1,1,])  # note that, in particular, this is a vector not an array of dimension 1
  expect_identical(subtable(p, 1:2, list(1,1), drop=FALSE), p[1,1,,drop=FALSE])
  expect_identical(subtable(p, 1:2, list(1:2,1)), p[1:2,1,])
  expect_identical(subtable(p, 1:2, list(1:2,1), drop=FALSE), p[1:2,1,,drop=FALSE])
})

Try the rje package in your browser

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

rje documentation built on Nov. 12, 2022, 9:06 a.m.