ourMELONS/R/cell.R

15 lines
510 B
R
Raw Normal View History

2020-06-24 16:07:13 +02:00
#' @title Cell array
#' @description Creates an array of zeros
#' @param n a the first dimension (or both, if sz is not passed)
#' @param sz the second dimension (or 1st and 2nd, if not passed)
2020-06-24 16:49:31 +02:00
#' @param ... Other dimensions
2020-06-24 16:07:13 +02:00
#' @return An array of zeroes with the dimensions passed on call
cell <- function(n, sz = c(n, n), ...) {
if (length(sz) == 1 & missing(...)) {
return(array(dim = c(n, sz)))
} else if (length(sz) == 2) {
return(array(dim = sz))
} else {
return(array(dim = c(n, sz, ...)))
}
}