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 "wk" not found > > -- trying to create it at top level first: > > wk <- c() > > with(d, wk <- split(word,kind)) > > wk > NULL
Like this: wk <- with(d, split(word, kind)) > wk $`1` [1] a b c Levels: a b c d e f g h i j $`2` [1] d Levels: a b c d e f g h i j $`3` [1] e Levels: a b c d e f g h i j $`4` [1] f Levels: a b c d e f g h i j $`5` [1] g h Levels: a b c d e f g h i j $`7` [1] i j Levels: a b c d e f g h i j > Cheers, > Alexy > [[alternative HTML version deleted]] > > ______________________________________________ > 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. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 ______________________________________________ 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.