tests/testthat/test_shape.R

context("dim function simplified")
library(dst)
test_that("shape", {
# test vector lengtx
z1 <- c("a", "b", "c")
result <- shape(z1)
expect_equal(result, 3)
# test matrix dim
z2 <- matrix(c(1:6), nrow=3)
result <- shape(z2)
expect_equal(result, c(3,2))
})

Try the dst package in your browser

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

dst documentation built on Nov. 16, 2023, 5:08 p.m.