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

take

Take a subset along an arbitrary dimension


Description

Take a subset along an arbitrary dimension

Usage

take(x, along, indices, drop = FALSE)

Arguments

x

matrix or array to subset

along

dimension to subset along

indices

the indices to select

drop

should the dimensions of the array be simplified? Defaults to FALSE which is the opposite of the useful R default.

Examples

x <- array(seq_len(3 * 4 * 5), c(3, 4, 5))
take(x, 3, 1)
take(x, 2, 1)
take(x, 1, 1)
take(x, 3, 1, drop = TRUE)
take(x, 2, 1, drop = TRUE)
take(x, 1, 1, drop = TRUE)

plyr

Tools for Splitting, Applying and Combining Data

v1.8.6
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre]
Initial release

We don't support your browser anymore

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