I have two data sets. One has duplicate location names, another one has location name and its lat long. I want to add lat long to first data set where the location name matches in second data set.
df1
Code Station Name
BNC BANGALORE CANT
BNC BANGALORE CANT
BNC BANGALORE CANT
BBS BHUBANESWAR
BBS BHUBANESWAR
df2
Station Name lat lon
BANGALORE CANT 12.993690 77.59814
BHUBANESWAR 20.296059 85.82454
expected result df1
Code Station Name lat lon
BNC BANGALORE CANT 12.993690 77.59814
BNC BANGALORE CANT 12.993690 77.59814
BNC BANGALORE CANT 12.993690 77.59814
BBS BHUBANESWAR 20.296059 85.82454
BBS BHUBANESWAR 20.296059 85.82454
It is obvious that object length differs. And I need the df1 duplicate entry. cbind won't work as length differs. same for ifelse and if with sapply. Getting lat long for df1 using geocode fails as the list is long (query max exceeded). Any thoughts?