Learn R Programming

crunch (version 1.30.4)

translateCubeIndex: Translate user facing cube subset to programmatic cube subset

Description

Cubes that include multiple response variables create a special kind of complexity. Multiple response variables are actually 2d arrays with the responses along one dimension (cat, dog, fish) and the selection status along the second dimension (selected, not_selected). When an MR variable is crossed with a categorical variable it creates a 3d array with the categorical variable's categories along one dimension and the MR dimensions on the other two.

Usage

translateCubeIndex(x, subset, drop)

Value

a list of array extent indices (for the real-cube)

Arguments

x

a Crunch Cube

subset

a list of array extent indices (for the user-cube)

drop

whether to drop unnecessary dimensions.

Details

The complexity is that while the real MR cube includes two dimensions per MR, we only show the user one dimension per MR which represents only the selected items. This means that every cube has two different representations, the low dimensional user cube, and the higher dimensional real cube. This function translates user cube subsets into the higher dimensional subset. In the case above, the user would see a 2d cube and subset it with user_cube[1:2, 1:2] in order to subset the programmatic cube we need to translate this to prog_cube[1:2, 1:2, ] in order to select the right variables of the high dimensional cube.