Details of *what* didn't work would be helpful, like for example
error messages.

Regardless, I'd do it like this:

subd <- d[, d$gene %in% c("i1","i2","i3"), ]


> d
  gene 1  2  3
1   i1 1  6 11
2   i5 2  7 12
3   i2 3  8 13
4   i3 4  9 14
5   i1 5 10 15

> d[d$gene  %in% c("i1","i2","i3"), ]
  gene 1  2  3
1   i1 1  6 11
3   i2 3  8 13
4   i3 4  9 14
5   i1 5 10 15

Sarah

On Wed, Dec 29, 2010 at 5:29 PM, ANJAN PURKAYASTHA
<anjan.purkayas...@gmail.com> wrote:
> nope, that did not work.
> thanks though.1"
> Anjan
>
> On Wed, Dec 29, 2010 at 5:02 PM, Jonathan Flowers <
> jonathanmflow...@gmail.com> wrote:
>
>> Try subd <- d[, "gene" == c("i1","i2","i3")]
>>
>> On Wed, Dec 29, 2010 at 4:55 PM, ANJAN PURKAYASTHA <
>> anjan.purkayas...@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
>>>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
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.

Reply via email to