Learn R Programming

s2dverification (version 2.4.0)

InsertDim: Adds A Dimension To A Matrix

Description

Add one dimension to the matrix var in position posdim with length lendim and which correspond to lendim repetitions of the var matrix.

Usage

InsertDim(var, posdim, lendim)

Arguments

Value

Matrix with the added dimension.

Examples

Run this code
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