I have two dataframes. df1:
Species | Catch by Year |
---|---|
101 | 2500 |
101 | 1759 |
116 | 111 |
139 | 178 |
and df2:
code | name |
---|---|
101 | COD |
116 | YELLOWTAIL |
139 | BLUE ANTIMORA |
144 | CUSK |
and I would like to combine both data frames such that the names from df2 replace the Species codes in df1:
Species | Catch by Year |
---|---|
COD | 2500 |
COD | 1759 |
YELLOWTAIL | 111 |
BLUE ANTIMORA | 178 |
I considered using a match function to achieve this but I am quite lost. Any help is appreciated.