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 ... Thanks in advance Barth PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance.
On Fri, Feb 11, 2011 at 10:39 AM, Barth B. Riley <bbriley at 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