Thanks all for your help.
Anjan

On Sun, Oct 24, 2010 at 1:38 PM, Jorge Ivan Velez
<jorgeivanve...@gmail.com>wrote:

> Hi Anjan,
>
> Please consider the following example:
>
> > x <- c(2, rep(1, 10))
> > all(x == 1)
> [1] FALSE
> > d <- replicate(10, sample(x, replace = TRUE))
> > d
>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
>  [1,]    1    1    1    1    1    1    2    1    1     1
>  [2,]    1    1    1    2    1    2    1    2    1     1
>  [3,]    1    1    1    1    1    1    1    1    1     1
>  [4,]    1    1    1    1    1    1    1    1    2     1
>  [5,]    1    1    1    1    2    1    1    1    1     1
>  [6,]    2    1    1    1    1    1    1    1    1     1
>  [7,]    1    1    1    1    1    1    1    1    2     1
>  [8,]    1    1    2    1    1    1    1    1    1     1
>  [9,]    1    2    2    1    2    1    1    1    2     1
> [10,]    1    1    1    1    1    1    1    1    1     1
> [11,]    1    1    1    1    1    1    1    1    1     1
> > d[apply(d, 1, function(v) all(v==1)), ]
>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
> [1,]    1    1    1    1    1    1    1    1    1     1
> [2,]    1    1    1    1    1    1    1    1    1     1
> [3,]    1    1    1    1    1    1    1    1    1     1
>
>
> HTH,
> Jorge
>
>
> On Sun, Oct 24, 2010 at 1:32 PM, ANJAN PURKAYASTHA <> wrote:
>
>> Hi,
>> I have a dataframe with 43 columns and a 1000 rows.  Each entry in the
>> dataframe can be either P or A.
>> here is a small chunk:
>>         c1    c2 ...    c43
>> r100  P     A   ...      P
>> r101  A     A   ...      A
>> r102  P     P   ...      P
>>
>> How does one subset this data frame to select those rows that have only
>> P's
>> in them?
>>
>> Thanks in advance.
>> 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.
>>
>
>


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

Reply via email to