Learn R Programming

plotrix (version 3.8-2)

sliceArray: Slice an array

Description

Slices one dimension from an array by taking one element from the first dimension.

Usage

sliceArray(x,slice)

Value

The desired slice of the array.

Arguments

x

An array

slice

The index of the slice to take from the first dimension of the array.

Author

Jim Lemon

Details

sliceArray builds an extractor string containing the value of slice as the first element and as many commas as needed to match the dimensions of the array. It then applies the extractor function to x and returns the result. Note how the array "slice" swaps dimensions in the example.

See Also

Examples

Run this code
 a1<-array(1:27,dim=c(3,3,3))
 a1
 sliceArray(a1,2)

Run the code above in your browser using DataLab