[R] extract positive pairs

Roslina Zakaria zroslina at yahoo.com
Wed Jan 28 02:05:35 CET 2009


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.







More information about the R-help mailing list