-1

I have two data frames of unequal number of rows:

df1

Label   Country    Year
NU      Germany    1999
BU      Italy      1945
LU      France     2009
KM      Sweden     1998
NU      Germany    1999

and

df2

Make     Label     
X1       NU
X2       BU
X3       NU
X4       NU
X5       KM

What I would like to do is match on "Label" and end up with the following:

Make   Label    Country     Year
X1       NU     Germany     1999
X2       BU     Italy       1945
X3       NU     Germany     1999
X4       NU     Germany     1999
X5       KM     Sweden      1998
monarque13
  • 568
  • 3
  • 6
  • 27

1 Answers1

0
 a=merge(df2,df1,by="Label")
 a[!duplicated(a),]
   Label Make Country Year
 1    BU   X2   Italy 1945
 2    KM   X5  Sweden 1998
 3    NU   X1 Germany 1999
 5    NU   X3 Germany 1999
 7    NU   X4 Germany 1999
Onyambu
  • 67,392
  • 3
  • 24
  • 53