I am using the Googleway
package, specifically, the google_places()
function to extract store data. I understood that each google_places()
call produce 20 data and I can access a total of 60 with next page token. My problem is, I was able to access the second 20 data points, but not the last 20 as it prompts a error message.
key <- 'insert own api key'
loc <- c(33.685494, -117.812070)
df <- google_places(place_type = "store",location = loc, radius = 1500, key = key)
df_next <- google_places(place_type = "store",location = loc, radius = 1500, key = key, page_token = df$next_page_token)
Until this point everything works and I was able to get 40 stores.
df_next_two <- google_places(location = loc, radius = 1500, key = key, page_token = df_next$next_page_token)
This creates an error:
Error: lexical error: invalid char in json text.
https://maps.googleapis.com/map
(right here) ------^
Is there a way to get around this? Thanks.