Hi Joao,

Here is one way (d is your data set):

d[apply(d == 'P', 1, any),]

HTH,
Jorge


On Wed, Aug 31, 2011 at 1:28 PM, Joao Fadista <> wrote:

> Dear all,
>
> I would like to know how to subset a data.frame by rows.
>
> Example:
>
>   Probesets            34884            34888            34892
> 1 100009676_at         A                   A                    A
> 2 10001_at                P                   P                     P
> 3 10002_at                A                   A                     A
> 4 10003_at                A                   A                     A
> 5 100048912_at         P                   A                     A
>
> For this data.frame I want to retrieve only the rows where at least one ´P´
> is found. So in this example it would be rows 2 and 5.
>
> Best regards and thanks in advance
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> [email protected] 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]]

______________________________________________
[email protected] 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