| subtable | R Documentation | 
More flexible calls of [ on an array.
subtable(x, variables, levels, drop = TRUE)
subarray(x, levels, drop = TRUE)
subtable(x, variables, levels) <- value
subarray(x, levels) <- value
| x | An array. | 
| variables | An integer vector containing the dimensions of  | 
| levels | A list or vector containing values to retain. | 
| drop | Logical indicating whether dimensions with only 1 retained
should be dropped.  Defaults to  | 
| value | Value to assign to entries in table. | 
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].
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.
subarray(): Flexible subsetting
subtable(x, variables, levels) <- value: Assignment in a table
subarray(x, levels) <- value: Assignment in an array
Mathias Drton, Robin Evans
Extract
x = array(1:8, rep(2,3))
subarray(x, c(2,1,2)) == x[2,1,2]
x[2,1:2,2,drop=FALSE]
subarray(x, list(2,1:2,2), drop=FALSE)
subtable(x, c(2,3), list(1, 1:2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.