api_tab_slice | R Documentation |
Functions for extracting slices of arrays
tab_slice(
tab,
slice = NULL,
margin = names(slice),
drop = TRUE,
as.array = FALSE
)
tab_slice_prim(tab, slice, drop = TRUE)
tab_slice_mult(tab, slice, val = 1, comp = 0)
tab_slice_to_entries(tab, slice, complement = FALSE)
tabSliceMult(tab, slice, val = 1, comp = 0)
tabSlice(
tab,
slice = NULL,
margin = names(slice),
drop = TRUE,
as.array = FALSE
)
tab |
An array with named dimnames. |
slice |
A list defining the slice. |
margin |
Names of variables in slice. |
drop |
If TRUE then dimensions with only one level will be dropped from the output. |
as.array |
If the resulting array is one-dimensional the result will by default be a vector with no dim attribute unless as.array is TRUE. |
val |
The values that entries in the slice will be multiplied with. |
comp |
The values that entries NOT in the slice will be multiplied with. |
complement |
If TRUE the complement of the entries are returned. |
Søren Højsgaard, sorenh@math.aau.dk
x = HairEyeColor
s = list(Hair=c("Black", "Brown"), Eye=c("Brown", "Blue"))
s1 = tab_slice(x, slice=s); s1
tab_slice_to_entries(x, slice=s)
tab_slice_to_entries(x, slice=s, complement=TRUE)
## tab_slice_mult
s2 = tab_slice_mult(x, slice=s); s2
sp = list(c(1,2), c(1,2), TRUE)
tab_slice_prim(x, slice=sp)
tab_slice(x, slice=s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.