Dear Roslina,
Try this:

index<-apply(y1y2,1,function(x) all(x>0))
y1y2[index,]

HTH,

Jorge


On Tue, Jan 27, 2009 at 8:05 PM, Roslina Zakaria <zroslina@yahoo.com> wrote:

> Hi,
>
> I have a data below and would like to search for positive pairs only and
> form a new data set.
>            X1             X2
> 31.0 9.0
> 11.0 1.0
> 1.0 0.0
> 0.0 0.0
> 8.0 0.0
> 0.0 0.0
> 2.0 2.0
> 18.0 3.0
> 0.0 0.0
> 0.0 0.0
> 0.0 0.0
> 10.0 0.0
> 6.0 0.0
> ...
>
> The new data will be
>
> X1'   X2'
> 31.0 9.0
> 11.0 1.0
> 2.0 2.0
> 18.0 3.0
>
> I tried to write the function as:
>
> y1y2 <-  read.csv("genX1X2.csv", header=FALSE)
> (y1y2[,1] > 0 )  &&  (y1y2[,2]>0)
> cbind(y1y2[,1],y1y2[,2])
>
> Thank you for your help.
>
>
>
>
> ______________________________________________
> 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]]


