R/arrays.R

Defines functions arrayto3d arrayto2d

arrayto3d <- function(x, dim2 = 2L) {
	d <- dim(x)
	if(length(dim(x)) != 2L) stop("'x' is not 2-dimensional")
	dim(x) <- c(d[1L], dim2, d[2L] / dim2)
	x
}

arrayto2d <- function(x) {
	d <- dim(x)
	if(length(dim(x)) != 3L) stop("'x' is not 3-dimensional")
	dim(x) <- c(d[1L], d[2L] * d[3L])
	x
}

Try the ibmpm package in your browser

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

ibmpm documentation built on May 2, 2019, 5:45 p.m.