indexDatacube: Create logical index matrices for multidimensional datacubes

Description Usage Arguments Value Author(s)


This function facilitates supplying logical index array for only some but not all of the dimensions of a data array. This mimics Matlabs indexing scheme. The indexing mechanisms of R only allow supplying logical indices for all dimensions.


indexDatacube(datacube = c(), logical.ind, dims = "auto", dims.datacube = dim(datacube))



array: datacube from which to extract the sub-parts datacube and dims.datacube should be supplied.


logical array: TRUE/FALSE index matrix for a subset of the dimensions of the datacube. The size of logical.ind's dimensions has to match the sizes of the corresponding dimensions in datacube.


integer vector or 'auto' : indices of the dimensions in datacube corresponding to the dimensions of logical.ind. If set to 'auto' this matching is tried to be accomplished by comparing the sizes of the dimensions of the two objects.


integer vector: dimensions of the datacube. Only one of dims.datacube or datacube should be supplied!


integer index matrix which can be used to index datacube


Jannis v. Buttlar

Search within the package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.