Skip to content
Prev 236598 / 398500 Next

How to apply vector value function to a multidimensional array indexed by the remaining dimensions?

apply() is your friend. You can specify more than one dimension in
argument 'MARGIN'.  Example:
[,1] [,2] [,3] [,4] [,5]
[1,]    6   42   78  114  150
[2,]   15   51   87  123  159
[3,]   24   60   96  132  168
[4,]   33   69  105  141  177
[,1] [,2] [,3] [,4] [,5]
[1,]    6   42   78  114  150
[2,]   15   51   87  123  159
[3,]   24   60   96  132  168
[4,]   33   69  105  141  177
/Henrik
On Fri, Oct 1, 2010 at 12:38 PM, yunjiangster <yunjiangster at gmail.com> wrote: