InsertDim: Adds A Dimension To An Array

View source: R/InsertDim.R

InsertDimR Documentation

Adds A Dimension To An Array

Description

Inserts an extra dimension into an array at position 'posdim' with length 'lendim' and which correspond to 'lendim' repetitions of the 'var' array.

Usage

InsertDim(var, posdim, lendim)

Arguments

var

Matrix to which a dimension should be added.

posdim

Position of the new dimension.

lendim

Length of the new dimension.

Value

Matrix with the added dimension.

Author(s)

History:
0.1 - 2011-03 (V. Guemas) - Original code
1.0 - 2013-09 (N. Manubens) - Formatting to R CRAN
1.1 - 2015-03 (N. Manubens) - Improvements

Examples

a <- array(rnorm(15), dim = c(3, 1, 5, 1))
print(dim(a))
print(dim(a[, , , ]))
print(dim(InsertDim(InsertDim(a[, , , ], 2, 1), 4, 1)))


s2dverification documentation built on April 20, 2022, 9:06 a.m.