powered by
Take a subset along an arbitrary dimension
take(x, along, indices, drop = FALSE)
matrix or array to subset
dimension to subset along
the indices to select
should the dimensions of the array be simplified? Defaults to FALSE which is the opposite of the useful R default.
FALSE
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)
Run the code above in your browser using DataLab