entry: An entry in an array (a number indexing a vector).
slice_marg: Vector giving the margin of a table, eg. c(2, 3)
slice_cell: Vector giving the corresponding cell of marginal table, e.g. c(1, 2)
perm: Vector giving permutaion of array, eg. c(1, 3, 2).
Examples
di <- c(2,2,3)cell2entry(c(1,1,1), dim=di)cell2entry(c(2,2,3), dim=di)entry2cell(1, dim=di)entry2cell(12, dim=di)next_cell(c(1,1,1), dim=di)next_cell(c(2,1,1), dim=di)## The first two entries are kept fixednext_cell_slice(c(2,1,1), dim=di, slice_marg=c(1,2))next_cell_slice(c(2,1,2), dim=di, slice_marg=c(1,2))## Cell (2, 2, 1) corresponds to entry 4cell2entry(c(2,2,1), dim=di)## Same ascell2entry_perm(c(2,2,1), dim=di, perm=c(1,2,3))## If the table dimensions are permuted as (3, 1, 2)## the entry becomescell2entry_perm(c(2,2,1), dim=di, perm=c(3,1,2))