Hello Alexandre,
I am writing a loop to compare scientific plant names from one data frame
in a second data frame containing a smaller set of potentially different
plant names, and then to copy the associated abundances of the sp already
present in the first database, and add the new species to the bottom.
Perhaps, you can use merge() function ?
+
family=c("Burseraceae","Anacardiaceae","Euphorbiaceae","Anacardiaceae","Apocynaceae",
+ "Sapotaceae","Malpighiaceae","Polygonaceae","Burseraceae"),
+
genus=c("Coccoloba","Tapirira","Pogonophora","Thyrsodium","Himatanthus","Pouteria",
+ "Byrsonima","Coccoloba","Protium"),
+ epithet=c("cf.
cordifolia","guianensis","schomburgkiana","spruceanum","phagedaenicus",
+ "coriacea","sericea","cf. cordifolia","heptaphyllum"),
+ abundance=c(224,112,146,115,47,71,25,29,37))
+ genus=c("Coccoloba","Protium","Bowdichia","Sclerolobium","Ocotea"),
+ epithet=c("cf.
cordifolia","heptaphyllum","virgilioides","densiflorum","glomerata"),
+ abundance=c(29,37,15,15,16))
merge.data.frame(base,new.base,by=c("genus", "epithet"), all=TRUE)
genus epithet family abundance.x abundance.y
1 Byrsonima sericea Malpighiaceae 25 NA
2 Coccoloba cf. cordifolia Burseraceae 224 29
3 Coccoloba cf. cordifolia Polygonaceae 29 29
4 Himatanthus phagedaenicus Apocynaceae 47 NA
5 Pogonophora schomburgkiana Euphorbiaceae 146 NA
6 Pouteria coriacea Sapotaceae 71 NA
7 Protium heptaphyllum Burseraceae 37 37
8 Tapirira guianensis Anacardiaceae 112 NA
9 Thyrsodium spruceanum Anacardiaceae 115 NA
10 Bowdichia virgilioides <NA> NA 15
11 Ocotea glomerata <NA> NA 16
12 Sclerolobium densiflorum <NA> NA 15
Fabrice
---
Fabrice Dessaint
UMR 1347 Agro?cologie
INRA/AgroSup/uB
17 rue Sully,
BP 86510 F-21065 Dijon Cedex
Tel: +33 (0)3 80 69 31 83
???????????????????????????
ResearchID: http://www.researcherid.com/rid/F-1102-2014
ORCID: http://orcid.org/0000-0001-9135-598X
ResearchGate: http://www.researchgate.net/profile/Fabrice_Dessaint