0

I have a dataframe "dfA" and dataframe "dfB"

str(dfA)
'data.frame':   594 obs. of  2 variables:
 $ DrainID: num  1673 1673 1674 1675 1675 ...
 $ L      : num  NA NA NA NA NA NA NA NA NA NA …


str(dfB)
'data.frame':   83 obs. of  2 variables:
 $ DrainID: num  1673 1674 1675 1676 1677 ...
 $ L      : num  35924 14027 17235 18156 24060 …

I want to replace dfA$L with dfB$L considering the DrainID which is common to both the dataframe.

I want my dataframe "dfA" to look like:

head(dfA)
  DrainID  L
1    1673 35924
2    1673 35924
3    1674 14027
4    1675 17235
5    1675 17235
6    1676 18156

Any help would be appreciated?

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
Vasker Sharma
  • 187
  • 1
  • 16

0 Answers0