On Fri, Feb 11, 2011 at 10:39 AM, Barth B. Riley <bbri...@chestnut.org> wrote: > Dear list > > I am trying to figure out how to create a ragged array that consists of > groups of array elements (indices from the original array) of similar values. > I would like to create a ragged array that might look something like this: > > S[1] > 11, 19, 14,7 > > S[2] > 29,4,1,13,44 > > S[3] > 56,9,2,35 > > S[4] > 3,5 >
Try stack and unstack: S <- list(A = c(11,19,14,7), B = c(29,4,1,13,44), C = c(56,9,2,35), D = c(3,5)); S stk <- stack(S); stk ustk <- unstack(stk); ustk identical(ustk, S) # TRUE -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.