Hi, I'm having a problem with a step that should be pretty simple. I have a dataframe, d, with column names : gene s1 s2 s3. The column "gene" stores an Id; the rest of the columns store intensity data. I would like to extract the rows for gene Ids i1, i2, i3 ( I know a priori that those rows exist). So I do this: subset(d, gene %in% c(i1, i2, i3)). This does not give me the required data. Any ideas where I am going wrong? TIA, Anjan -- ==================================anjan purkayastha, phd. research associate fas center for systems biology, harvard university 52 oxford street cambridge ma 02138 phone-703.740.6939 ================================== [[alternative HTML version deleted]]
Try subd <- d[, "gene" == c("i1","i2","i3")] On Wed, Dec 29, 2010 at 4:55 PM, ANJAN PURKAYASTHA < anjan.purkayastha@gmail.com> wrote:> Hi, > I'm having a problem with a step that should be pretty simple. > I have a dataframe, d, with column names : gene s1 s2 s3. The column > "gene" > stores an Id; the rest of the columns store intensity data. > I would like to extract the rows for gene Ids i1, i2, i3 ( I know a priori > that those rows exist). > So I do this: > subset(d, gene %in% c(i1, i2, i3)). > This does not give me the required data. > Any ideas where I am going wrong? > TIA, > Anjan > > -- > ==================================> anjan purkayastha, phd. > research associate > fas center for systems biology, > harvard university > 52 oxford street > cambridge ma 02138 > phone-703.740.6939 > ==================================> > [[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. >[[alternative HTML version deleted]]
Hi Anjan, Try subset(d, gene %in% c("i1", "i2", "i3")) HTH, Jorge On Wed, Dec 29, 2010 at 4:55 PM, ANJAN PURKAYASTHA <> wrote:> Hi, > I'm having a problem with a step that should be pretty simple. > I have a dataframe, d, with column names : gene s1 s2 s3. The column > "gene" > stores an Id; the rest of the columns store intensity data. > I would like to extract the rows for gene Ids i1, i2, i3 ( I know a priori > that those rows exist). > So I do this: > subset(d, gene %in% c(i1, i2, i3)). > This does not give me the required data. > Any ideas where I am going wrong? > TIA, > Anjan > > -- > ==================================> anjan purkayastha, phd. > research associate > fas center for systems biology, > harvard university > 52 oxford street > cambridge ma 02138 > phone-703.740.6939 > ==================================> > [[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. >[[alternative HTML version deleted]]