[.tables {contingency} | R Documentation |
Subset object of class tables
Description
Take subset of tables class.
Usage
## S3 method for class 'tables'
x[i, j, ..., drop = TRUE, keep = FALSE]
Arguments
x |
object of class |
i |
indicies of which tables to retain |
j |
which rows of each table to retain (or if |
... |
additional indices up to the dimension of the table |
drop |
usual logical indicating whether to consolidate margins of the table (doesn't apply to |
keep |
if only one table is specified with |
Details
There are two main ways to subset these tables. In both cases the first index
refers to the tables being selected; one of the methods is to additionally specify all the
indices corresponding to the tables, the other is to only specify a single entry.
For example, x[,1,2,2]
specifies the (1,2,2)th entry of each table; x[,7]
will
have the same effect for 2x2x2 tables.
If only one index is specified, then the function behaves just as ordinary subsetting on an array.
Value
A tables object over the specific entries and values selected.
Examples
x <- rprobMat(n=10, rep(2,3))
x[1,]
x[,1,1:2,1]
x[,1,1:2,1,drop=FALSE]