Learn R Programming

s2dverification (version 2.5.0)

SelIndices: Slices A Matrix Along A Dimension

Description

This function allows to select a subensemble from a matrix of any dimensions, providing the dimension along which the user aims at cutting the input matrix and between which indices.

Usage

SelIndices(var, posdim, limits)

Arguments

var
A matrix of any dimensions.
posdim
The dimension along which a submatrix should be selected.
limits
The lower and upper indice of the selection along the posdim dimension.

Value

The sliced matrix.

Examples

Run this code
a <- array(rnorm(24), dim = c(2, 3, 4, 1))
print(a)
print(a[, , 2:3, ])
print(dim(a[, , 2:3, ]))
print(SelIndices(a, 3, c(2, 3)))
print(dim(SelIndices(a, 3, c(2, 3))))

Run the code above in your browser using DataLab