Re: [R] ragged array with append

2007-11-24 Thread Peter Dalgaard
Alexy Khrabrov wrote: > On Nov 24, 2007, at 2:07 PM, Chuck Cleland wrote: > > >> with(d, split(word, kind)) >> >> # OR >> >> with(d, split(as.character(word), kind)) >> > > Awesome! Scoping: how do I get the result back to the top level? > > > with(d, wk <- split(word,kind)) > > wk > Err

Re: [R] ragged array with append

2007-11-24 Thread Chuck Cleland
Alexy Khrabrov wrote: > On Nov 24, 2007, at 2:07 PM, Chuck Cleland wrote: > >> with(d, split(word, kind)) >> >> # OR >> >> with(d, split(as.character(word), kind)) > > Awesome! Scoping: how do I get the result back to the top level? > > > with(d, wk <- split(word,kind)) > > wk > Error: object

Re: [R] ragged array with append

2007-11-24 Thread Alexy Khrabrov
On Nov 24, 2007, at 2:07 PM, Chuck Cleland wrote: > with(d, split(word, kind)) > > # OR > > with(d, split(as.character(word), kind)) Awesome! Scoping: how do I get the result back to the top level? > with(d, wk <- split(word,kind)) > wk Error: object "wk" not found -- trying to create it at

Re: [R] ragged array with append

2007-11-24 Thread Chuck Cleland
Alexy Khrabrov wrote: > I wonder what's the right way in R to do the following -- placing > objects of the same kind together in subarrays of varying length. > Here's what I mean: > > > word <- c("a","b","c","d","e","f","g","h","i","j") > > kind <- c(1,1,1,2,3,4,5,5,7,7) > > d <- data.fram

[R] ragged array with append

2007-11-24 Thread Alexy Khrabrov
I wonder what's the right way in R to do the following -- placing objects of the same kind together in subarrays of varying length. Here's what I mean: > word <- c("a","b","c","d","e","f","g","h","i","j") > kind <- c(1,1,1,2,3,4,5,5,7,7) > d <- data.frame(word,kind) > d word kind 1