Skip to content
Prev 79824 / 398502 Next

How to manipulate an abitrary dimensioned array.

Mike Meyer <mikem at salter-point.com> writes:
I think Berton was hinting at

   apply(X,5,"[",1)

(it does get trickier if you need X[,,2,,,1] or X[,,3:4,,,1:2] because
dimensions tend to get lost on the way into and out of the apply FUN
argument.)

In general, you can use do.call constructs, with TRUE for the missing
arguments (there seems to be no nice way to pass missing to do.call).