[R] Splitting Large Data Frame into Two
Sarah Goslee
sarah.goslee at gmail.com
Wed Jun 13 18:02:43 CEST 2012
How are you deciding which values in the first column go into which subset?
If you have a vector containing those values, you could use %in% or if
they're determined logically you could use that criterion.
A reproducible example and a bit more information would get you more
concrete answers.
Sarah
On Wed, Jun 13, 2012 at 11:06 AM, Joshua Budman <josh.budman at gmail.com> wrote:
> Hi
> I have a large data frame of the form:
> a 1
> b 2
> c 3
> And I would like to split this data frame into two separate data
> frames based on the values in the first column, e.g.
> a 1
> b 2
> and
> c 3
>
> Is there any way of doing this without having to write a different
> "which" statement for each value in column 1 and then doing an "rbind"
> at the end? I tried using an if/else statement using a lot of
> "||" but that did not work well either. Help would be much appreciated.
>
> Thanks,
> Josh
--
Sarah Goslee
http://www.functionaldiversity.org
More information about the R-help
mailing list