[R] Finding not-matching rows in tables

Vittorio vdemart1 at tin.it
Wed Feb 7 14:23:45 CET 2007


I have these two dataframes in which 'id' is the key field
> tabella
   
id          nome
1   1      PIEMONTE
2   2  VALLED'AOSTA
3   3     
LOMBARDIA
4   4      TRENTINO
5   5        VENETO
6   6        FRIULI

AND

> tab
   id          nome
1   1      PIEMONTE
2   2  VALLED'AOSTA
3   3     LOMBARDIA
4   4      TRENTINO
5  25     CAMPANIA
6  28       
LAZIO

Is there any R-one-command able to select the only rows of tab 
that are not present in tabella, matching the two tables on 'id'?  The 
result should be

5  25     CAMPANIA
6  28       LAZIO

I was able to 
obtain this results by means of the merge command merging the two 
tables and selecting according to the <NA> fields, therefore in two 
steps....

Ciao
Vittorio



More information about the R-help mailing list