asub | R Documentation |
Subset an array with the supplied dimnames and - if defined - replace values.
asub(x, ..., drop = TRUE)
x |
An array with named dimensions. |
... |
One or several vectors of indices or character strings to be used
to subset |
drop |
Logical. If |
array (or vector if drop = TRUE
and only one dimension is left)
of the selected subset of x
.
my_array <- array(1,
dim=c(cell = 67, month = 12, band = 3),
dimnames = list(cell = 0:66,
month = 1:12,
band = c("band1", "band2", "band3")))
my_subset <- asub(my_array,
band = c("band1", "band3"))
dimnames(my_subset)[3]
# $ band
# [1] "band1"
# [2] "band3"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.