Message-ID: <AANLkTimhcg8fefsRh4YQcOu-ZO7_XbRYT7fxaemno6aD@mail.gmail.com>
Date: 2010-12-03T16:30:15Z
From: Steve Lianoglou
Subject: subset of a dataframe
In-Reply-To: <1291393584075-3071326.post@n4.nabble.com>
Hi,
On Fri, Dec 3, 2010 at 11:26 AM, alcesgabbo <alcesgabbo at hotmail.com> wrote:
>
> HI,
> I have a dataframe like this:
>
> name ? ?type
> A ? ? ? ? ?t1
> B ? ? ? ? ? t2
> C ? ? ? ? ?t1
> D ? ? ? ? ? t1
> E ? ? ? ? ? t3
> F ? ? ? ? ? ?t2
>
> how can I have a "sub dataframe" based with the column "type" like this:
>
> (for type = t1)
>
> name ? ?type
> A ? ? ? ? ?t1
> C ? ? ? ? ?t1
> D ? ? ? ? ? t1
Let's say your data.frame is stored in a variable named "df":
R> subset(df, type == 't1')
Read the help files:
R> ?subset
Also take a look at ?split
-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