[R] Get subset of n dimensional matrix

2009-10-09 Thread Mark McDowall
I want to select a subset of an array, but I want to make a function so that it can handle any number of dimensions. This is probably best described with an example x - 1:100 dim(x) - c(10,10) x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]1 11 21 31 41 51 61

Re: [R] Get subset of n dimensional matrix

2009-10-09 Thread Henrique Dallazuanna
Try this: x - array(1:1000, rep(10, 3)) vList - list(i = 4:6, j = 4:6, ... = 4:6) do.call('[', c(list(x), vList)) On Fri, Oct 9, 2009 at 7:18 AM, Mark McDowall markmcdowa...@googlemail.com wrote: I want to select a subset of an array, but I want to make a function so that it can handle any