slice.tensor: Working with the indices of a tensor (accessing, slicing, renaming, ...)
Description
Indexing of tensors allows beside the ordinary selection of ranges
of indices the renaming of indices. The functions are mainly here to
keep the the tensor property of the results.
Usage
slice.tensor(X,i,what,drop=FALSE)
## Methods for class tensor
# X[...,drop=TRUE]
# X[...,drop=TRUE] <- value
# X[[...,drop=TRUE]]
# X[[...,drop=TRUE]] <- value
Value
a new tensor with dimensions renamed or individual levels selected
Arguments
X
A tensor
i
an index given as number or character
what
levels of the index, a number or a character from
dimnames
drop
a boolean, if true, indices with only a single level are
removed
...
arguments of the form name=indices, and for the
[[ ]] functions it also allowed to give names from the
corresponding dimnames name=c("a","b") to select indices by
names or name=~newname to rename dimensions, the first use
makes a usual array access in the given dimension, where [[ ]]
only supports a single index, while [ ] allows vectors. The
other type changes the names.
Author
K. Gerald van den Boogaart
Details
The functions allow to rename dimensions and to take select a part of
the tensor.