I'm updating taxonomy for birds and have two unique coding variables that code data from two other datasets. Some species are missing this data - this isn't an issue, we can duplicate this data across species that are closely related. However, scrolling up and down my thousands of observations to copy and paste these codes manually is taking a hefty amount of time, so I'm looking for a shortcut.
Species | Code Name | ID | CODE |
---|---|---|---|
Accipiter hiogaster | Accipiter Novae | ||
Accipiter novae | 94 | 20 |
My actual table is much longer than this but say I want to given Accipiter hiogaster the ID and CODE from Accipiter novae.
Is there a way I can get R to search for matches between Code Name and Species, and copy ID and CODE into the observation with the missing values when it finds a match?