sub-.tables: Subset object of class tables

[.tablesR 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 tables

i

indicies of which tables to retain

j

which rows of each table to retain (or if ... not specified, entries )

...

additional indices up to the dimension of the table

drop

usual logical indicating whether to consolidate margins of the table (doesn't apply to i)

keep

if only one table is specified with i, should the object output be an object of class tables? If not becomes a suitable array.

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]


contingency documentation built on Nov. 18, 2022, 5:08 p.m.