[R] How to separate a data set by its factors

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Dec 24 21:34:35 CET 2009


Hi,

On Thu, Dec 24, 2009 at 3:24 PM, James Rome <jamesrome at gmail.com> wrote:

> I think my question boils down to "how do you replace a whole data set
> by its factored subsets in all of the usual R commands?

I think the answer to your question is: I'm not sure that there's a
way to do that in "all of the usual R commands", but you can split up
your data first, then run "all of the usual R commands" on them :-)

Functions you want to look at are probably:

?split
?by and ?tapply

You might try to look at the plyr library first, though:
http://cran.r-project.org/web/packages/plyr/index.html

It provides some groovy ways to iterate/manipulate sets/subsets of data.

Hope that helps,
-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list