I have two dataframes. The first one is a list of names:
head(record_g)
no om_id nm_id
1 1 barnes hardy
2 2 fry3 long1
3 3 <NA> buckland1
The second one contains locations, one for each name:
master ID geometry
1 goulter Acton Turville POINT (-2.277019 51.52794)
2 sergeant1 Alderton POINT (-2.231605 51.54452)
3 baker2 Allington POINT (-2.151944 51.47325)
For each person from the first dataframe I need to 'pull' his location from the second dataframe, so that I have a dataframe similar to the first one with location ID's rather than names. I've tried a function:
geo <- function(x){
index <- match(x, places$master)
geo <- places$geometry[index]
geo
}
but it does not work with character variables. Could anybody help? Thank you.