Learn R Programming

s2dverification (version 2.10.3)

InsertDim: 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.

Examples

Run this code
# NOT RUN {
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)))

# }

Run the code above in your browser using DataLab