I am trying to geocode a couple of addresses in R. I am working with the geocode function from the tidygeocoder package in R. To make it faster I'd love to parallelize this function, but I do not know how this might work.
I am working on Windows.
Here is an example:
| id | street | state | county |
|---|---|---|---|
| 1 | 123 happiness | TT | South |
| 2 | 234 parallel | HH | North |
# create cluster
cl <- parallel::makeCluster(8, type = "PSOCK")
# geocode the addresses
latlon <- parallel::parLapply(cl=cl, geocode, .tbl = address_df, method = 'osm', lat = latitude , long = longitude, address = NULL, street = street, county = county, state = state)
street should be the list (is a column of ) I'm trying to run the parLapply function on and geocode the function. The geocode function does not let me use a vector for addresses. I have use all the options of geocode, street, county and state to get their latitude and longitude.
Is it possible to parallelize this function?
