Return a subset or a multidimensional matrix or array of undetermined size along a specific dimension. Specifically designed to return a single index along the specified dimension (e.g. one year or one region).

subset_matrix(mat, r, d = 1, drop = TRUE)

Arguments

mat

the input matrix to subset

r

the index along the dimensions of interest to subset by

d

the dimension to subset by

drop

whether to drop the subsetted dimension

Value

a subsetted matrix or array