Array operations; created to facilitate the gRain package in 2007. Now largely replaceable by other (often faster) functions implemented in Rcpp.

tablePerm(tab, perm, resize = TRUE, keep.class = FALSE)

tableMult(tab1, tab2)

tableDiv(tab1, tab2)

tableOp(tab1, tab2, op = "*")

tableOp2(tab1, tab2, op = `*`, restore = FALSE)

tableOp0(tab1, tab2, op = `*`)

tableSlice(tab, margin, level, impose)

tableSlicePrim(tab, mar.idx, lev.idx)

tableMargin(tab, margin, keep.class = FALSE)

tableGetSliceIndex(tab, margin, level, complement = FALSE)

tableSetSliceValue(tab, margin, level, complement = FALSE, value = 0)

Arguments

tab, tab1, tab2

Arrays with named dimnames.

perm

A permutation; either indices or names.

resize

A flag indicating whether the vector should be resized as well as having its elements reordered (default TRUE).

keep.class

Obsolete argument.

op

The operation; choices are "*", "/", "+", "-".

restore

Not so clear anymore.

margin

Index or name of margin.

level

Corresponding level of margin.

impose

Value to be imposed.

mar.idx

Index of margin

lev.idx

Index of level

complement

Should values be set for the complement?

value

Which value should be set

Details

tableOp0 is brute force implementation based on dataframes. It is very slow, but useful for error checking.