crunch (version 1.27.7)

translateHidden: Translate provided index to an index which accounts for hidden categories.

Description

When the user subsets a cube in which "useNA" is either "no" or "ifAny" they are not interacting with hidden categories. This function takes the index which they provide and translates it to an index which includes hidden categories.

Usage

translateHidden(index, not_hidden, drop = TRUE, vis = not_hidden)

Arguments

index

The index to be translated

not_hidden

Logical, TRUE indicates a category is not hidden.

drop

Should dimensions with a single category be dropped

vis

Logical, is a category visible or not. Because of the useNA behavior, categories can be visible even if they are hidden.

Value

The translated index

Details

For example, if v includes c("cat1", "hidden_cat", "cat2") and useNA is "no". The user will see v as c("cat1", "cat2") and might subset it with v[c(2,1)]. We need to skip over the hidden category and change the index to account for any hidden categories which might appear in the vector. Here the translated index would be c(3,1. This function does all of that.