I am trying to replicate the code given here but for google_places() instead of google_distance().
I have a dataframe with 2 columns: Latitude and Longitude.
I tried it like this:
set_key("my key number")
lapply(1:nrow(df), function(x){
google_places(location = c(df$Latitude, df$Longitude)),
search_string = 'Coffee Shop',
radius = 5000)
})
R returns: Error in validateGeocodeLocation(location) : location must be a vector of a pair of latitude and longitude coordinates
I tried different ways of looping, I change the dataframe to a list, also I tried putting the Latitude and Longitude in a single vector, but still I get the same error.
My df is 150 rows (that means 150 locations to go over). I just want the lists of the 20 places found in the radius around each location.