I am looking for a simple R command which will do the following. I have two tables A and B with three columns each- ID,YEAR,VALUE. I want to find out the rows from table B which have the same ID as table A, and have years which are not in table A. I then want to add these rows to A.
Table A
---------------------
| ID | YEAR | VALUE |
---------------------
| 1 | 2006 | A |
--------------------
| 1 | 2007 | B |
---------------------
| 1 | 2009 | D |
---------------------
| 1 | 2010 | E |
---------------------
Table B
---------------------
| ID | YEAR | VALUE |
---------------------
| 1 | 2006 | A |
--------------------
| 1 | 2007 | B |
---------------------
| 1 | 2008 | C |
---------------------
| 1 | 2009 | D |
---------------------
| 1 | 2010 | E |
---------------------
In the output table, only the third row in table B gets appended to table A.
I found this solution- Compare two table and adding row based on condition but it does not address multiple conditions.