Learn R Programming

gapfill (version 0.9.6-1)

Array2Matrix: Convert an Array with 4 Dimensions into a Matrix

Description

Converts the array, a, with 4 dimensions, c(d1, d2, d3, d4), into a matrix with d1*d2 rows and d3*d4 columns.

Usage

Array2Matrix(a)

Arguments

a

Array with 4 dimensions.

Value

A matrix. If a has the attribute mp, the transformed attribute is returned as well. See ArrayAround for more information about mp.

See Also

Index, ArrayAround.

Examples

Run this code
# NOT RUN {
a <- array(data = 1:16, dim = c(2, 2, 2, 2))
Array2Matrix(a = a)
attr(a, "mp") <- c(1, 2, 2, 1)
Array2Matrix(a = a)

Array2Matrix(ArrayAround(data = a, mp = c(1, 1, 1, 1),
                         size = c(1, 1, 2, 2))) 
# }

Run the code above in your browser using DataLab