tests/dimNA.R

library("R.utils")

x <- 1:12
dimNA(x) <- c(2,NA_real_,3)
stopifnot(dim(x) == as.integer(c(2,2,3)))

dimNA(x) <- NULL
stopifnot(is.null(dim(x)))


## Exception handling
x <- 1:12
res <- try(dimNA(x) <- c(4,NA_real_,4), silent=TRUE)
stopifnot(inherits(res, "try-error"))

Try the R.utils package in your browser

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

R.utils documentation built on Nov. 18, 2023, 1:09 a.m.