It should be easy but I am not able to do it. I have many files and each file is named by species name. I also have a data frame in which each column is named with the species names. I just want to extract the column from data frame and combine that column with the respective species files after changing the column name to let say, 'Common' probably in a loop, so that later on colud compare all the species.
Df:
ID Tilia_americana Fraxinus_americana Ulmus_americana
1 23 32 32
2 21 34 35
3 20 33 32
4 19 33 36
5 23 23 34
6 22 34 37
Sorry, for not being being specific earlier. As you can see the column names are species names, In addition I have three separate files with species names. The header of the first file is like this:
Tilia_americana:
ID Wie Rei Wee
1 2 4 3
2 4 3 4
3 3 2 5
4 5 5 2
5 6 3 4
6 7 4 3
and after extracting the column of Tilia_american from DF and changing the column name to 'Common' and combining it with the Tilia_american file the out put should be like this:
ID Wie Rei Wee Common
1 2 4 3 23
2 4 3 4 21
3 3 2 5 20
4 5 5 2 19
5 6 3 4 23
6 7 4 3 22
At the end want to save each file separetly... Thanks