[R] selecting rows based on multiple criteria

Enrico R. Crema enryu_crema at yahoo.it
Wed May 1 13:54:33 CEST 2013

Dear List, 

I am struggling with the following problem. 

Suppose I have the following data.frame:


and I want to extract the row numbers of those matching the criteria defined by the following data.frame:


the result should return in this case:


All I managed to do is the following:

which(data coord$x%in%choice$x & coord$y%in%choice$y);

which returns c(1,2,11,12)... which includes also the first row... 

Any thoughts?


More information about the R-help mailing list