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.
translateHidden(index, not_hidden, drop = TRUE, vis = not_hidden)
The translated index
The index to be translated
Logical, TRUE
indicates a category is not hidden.
Should dimensions with a single category be dropped
Logical, is a category visible or not. Because of the useNA
behavior,
categories can be visible even if they are hidden.
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.