[R] n-dimensional vector operations

Ken-JP kfmfe04 at gmail.com
Tue Apr 21 06:24:39 CEST 2009


Peter,

Thank you for your array() hint for multi-dimensional matrices.

Actually, my final answer should be of dimension 5,3,2 because my
funcp(a,b,c) will be reduced to one number when I set a to a column of x, b
to a column of y, and c to a column of z.

I did make some useful observations, though:

1. expand.grid() is useful for determining all the permutations of indexes I
need to use on the columns of x,y,z:  for example: expand.grid( 1:5, 1:3,
1:2 ) or expand.grid( list( 1:5, 1:3, 1:2 )); # the last one is useful when
I don't know how many dimensions I need to go - eg I may have 7 matrices.

2. I hate to do it, but memory usage can blow up really fast, so it looks
like I need to do some nested looping to get the job done - maybe I can
change these to xapply() later.

- Ken

-- 
View this message in context: http://www.nabble.com/n-dimensional-vector-operations-tp23147607p23148994.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list