Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sliceArray

Slice an array


Description

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

Usage

sliceArray(x,slice)

Arguments

x

An array

slice

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

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.

Value

The desired slice of the array.

Author(s)

Jim Lemon

See Also

Examples

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

plotrix

Various Plotting Functions

v3.8-1
GPL (>= 2)
Authors
Jim Lemon, Ben Bolker, Sander Oom, Eduardo Klein, Barry Rowlingson, Hadley Wickham, Anupam Tyagi, Olivier Eterradossi, Gabor Grothendieck, Michael Toews, John Kane, Rolf Turner, Carl Witthoft, Julian Stander, Thomas Petzoldt, Remko Duursma, Elisa Biancotto, Ofir Levy, Christophe Dutang, Peter Solymos, Robby Engelmann, Michael Hecker, Felix Steinbeck, Hans Borchers, Henrik Singmann, Ted Toal, Derek Ogle, Darshan Baral, Ulrike Groemping, Bill Venables
Initial release
2021-01-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.