1
I have two data frames. The first one has 2185 observations and the second one has only 9.
The first data frame, whose name is dados, contains the following variables:: local, parc, arv, DAP, Ht, Hf, epiteto and genero.
The second, named after coordg contains parcela, longitude, latitude and Eg.
I would like to insert the values of the environmental variable Eg of data frame coordg in the data frame dados, repeating the value of Eg for each arv, according to the name of parc common among data frames, as below:
Local parc arv DAP Ht Hf copa genero epiteto Eg
varzea MZVT2 1 11.777 14.1 13.5 0.6 Euterpe oleracea 0.016
varzea MZVT2 2 13.782 17.4 14.0 3.4 Euterpe oleracea 0.016
varzea MZVT2 3 9.326 11.1 4.0 7.1 Euterpe oleracea 0.016
varzea MZVT2 4 25.305 20.8 12.0 8.8 Calycophyllum spruceanum 0.016
varzea MZVT2 5 10.345 11.2 4.0 7.2 Indeterminada Indeterminada 0.016
You need a
left_join, see the answers to this question: https://answall.com/questions/124319/busca-valores-em-um-data-frame-e-addir-outro-r/124326#124326– Daniel Falbel