Returns a string describing the measure type of the cube result, such as "count", "mean", "sd", etc.

cubeMeasureType(x, measure = NULL)

# S4 method for CrunchCube
cubeMeasureType(x, measure = 1)

Arguments

x

A CrunchCube

measure

Which measure in the cube to check, can index by position with numbers or by name. NULL, the default, will select a "sum" type measure first, "mean" if no sum is available, and will use the cube's names in alphabetic order if there are no "sum" or "mean" measures (or if a tie breaker between two measure types is needed).

Value

A string describing the cube's measure type

Examples

if (FALSE) {
cube1 <- crtabs(~allpets, ds)
cubeMeasureType(cube1)
#> "count"

cube2 <- crtabs(list(a = n(), b = mean(age)) ~ allpets, ds)
cubeMeasureType(cube2)
#> "count"
cubeMeasureType(cube2, "b")
#> "mean"
}