I have a dataframe of data for 400,000 trees of 6 different species. Each species is assigned a numeric species code that corresponds with a specific species. I would like to add another column listing the scientific name of each tree. The species codes are not consecutive, as this data was filtered down from 490,000 trees of 163 species based on abundance. Here is an example of data similar to what I have:
Index Age Species_code
0 45 14
1 47 32
2 14 62
3 78 126
4 40 14
5 38 17
6 28 47
And here is an example of what I would like to get to:
Index Age Species_code Species
0 45 14 Licania_heteromorpha
1 47 32 Pouteria_reticulata
2 14 62 Chrysophyllum_cuneifolium
3 78 126 Eperua_falcata
4 40 14 Licania_heteromorpha
5 38 17 Simaba_cedron
6 28 47 Sterculia_pruriens
I have been trying things along the lines of
if (Species_code == 14)
{
}
However, this gives me TRUE
or FALSE
in the output