This is an internal function that powers dimSums()
collapse_dims(array_in, margins_to_collapse, collapsed_items)the margins that should be collapsed
vector of logicals if any of the dimensions in
margins_to_collapse are of the _items type
the array from a CrunchCube to collapse
the margins that should be kept
a duly-collapsed array