tests/testthat/test_setAttribute.R

context("setAttribute")

test_that("setAttribute", {
  x = 1:9
  x = setAttribute(x, "foo", "bar")
  x = setAttribute(x, "dim", c(3,3))
  expect_equal(attr(x, "foo"), "bar")
  expect_equal(nrow(x), 3)
  expect_equal(ncol(x), 3)
})

Try the BBmisc package in your browser

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

BBmisc documentation built on Sept. 29, 2022, 5:12 p.m.