Translated cell(), added tests
This commit is contained in:
parent
862a91febc
commit
31aeb99257
3 changed files with 41 additions and 0 deletions
14
R/cell.R
Normal file
14
R/cell.R
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#' @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)
|
||||
#' @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, ...)))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue