[R] array slice notation?
sjaffe at riskspan.com
Tue Aug 4 21:54:53 CEST 2009
Yes, I was thinking more in terms of mental operations than physical.
I think the following works, but it doesn't seem entirely transparent :-)
Given array A, and a vector of row indices v (ie 1 <= v <= dim(A)), the
slice of rows v is
A[ outer(v, dim(A)*( 1:prod(dim(A)[-1])-1 ), '+') ]
Steve Lianoglou-6 wrote:
> You actually don't have to convert A to a vector, you can use vector-
> style indexing into a matrix:
View this message in context: http://www.nabble.com/array-slice-notation--tp24814643p24815116.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help