Returns an array of dimension sapply(value, length) if
drop=TRUE, otherwise specified dimensions of size 1 are
dropped. Dimensions which are unspecified in subtable are never
dropped.
Arguments
x
An array.
variables
An integer vector containing the dimensions of x to
subset.
levels
A list or vector containing values to retain.
drop
Logical indicating whether dimensions with only 1 retained
should be dropped. Defaults to TRUE.
value
Value to assign to entries in table.
Functions
subarray: Flexible subsetting
subtable<-: Assignment in a table
subarray<-: Assignment in an array
Author
Mathias Drton, Robin Evans
Details
Essentially just allows more flexible calls of [ on an array.
subarray requires the values for each dimension should be specified,
so for a \(2 \times 2 \times 2\) array x,
subarray(x, list(1,2,1:2)) is just x[1,2,1:2].
subtable allows unspecified dimensions to be retained automatically.
Thus, for example subtable(x, c(2,3), list(1, 1:2)) is
x[,1,1:2].