[R] subsetting

Patrick Burns pburns at pburns.seanet.com
Sun May 30 18:41:24 CEST 2010


'&&' is scalar 'and' you want to use
the vector 'and' which is '&'.

On 30/05/2010 16:14, ANJAN PURKAYASTHA wrote:
> Hi,
> I have a data-frame,  r (column names below), that needs subsetting:
> date, time, strain, gene, deltact
>
> When I try to subset r by applying selection criteria on two columns I get
> an empty data frame. For example I would like to extract all rows that have
> time == 0h and strain == ROC.
> So, t<- subset(r, (r$time == "0h"&&  r$strain == "ROC"), select= c(time,
> strain, gene, deltact)) returns an empty data-frame.
> Is it not possible to subset based on two criteria?
> TIA
> Anjan
>

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')



More information about the R-help mailing list