On Mon, Jan 17, 2011 at 2:20 PM, Sean Zhang <seane...@gmail.com> wrote: > Dear R-Helpers, > > I wonder whether there is a function which cuts a multiple dimensional array > along a chosen dimension and then store each piece (still an array of one > dimension less) into a list. > For example, > > arr <- array(seq(1*2*3*4),dim=c(1,2,3,4)) # I made a point to set the > length of the first dimension be 1to test whether I worry about drop=F > option. > > brkArrIntoListAlong <- function(arr,alongWhichDim){ > #### > return(outlist) > } > > I have tried splitter_a in plyr package but does not get what I want. > > library(plyr) > plyr:::splitter_a(arr,3)
We'll you're really not supposed to call internal functions - you probably want: alply(arr, 3) but you don't say what is wrong with the output. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.