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
wrote:
> 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.
>
> Th
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
2 matches
Mail list logo