I have two data frames. The first one has 2185 observations and the second has only 9.
The first data frame whose name is dados
contains the following variables: local
, parc
, arv
, DAP
, Ht
, Hf
, epiteto
genero
.
The second, with coordg
name contains parcela
, longitude
, latitude
and Eg
.
I would like to insert the values of the environment variable Eg
of the data frame coordg
into the data frame dados
, repeating the value of Eg
for each arv
, according to the name of parc
in common between the 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