I have a dataset of the locations of various Tim Horton coffee shops within the USA. I applied the mutate_geocode() function to my dataset that contains 740 rows to get the latlon coordinates. I was able to successfully geocode 591 rows and returned NA's in 149 rows.
My geocode function code looks like this:
newdataset <- mutate_geocode(dataset, fullAddress, source = "google")
A sample/subset csv of the results that are NA are below
fullAddress,lon,lat
"109 Bennett Dr , Caribou , ME 4736",NA,NA
"1201 S Main St , Ann Arbor , MI 48104",NA,NA
"2679 Ann Arbor Saline Rd , Ann Arbor , MI 48103",NA,NA
I have gone through many of my NA's and can't figure out why the output of mutate_geocode() would be NA. If I copy paste the addresses into google maps I get the result I am looking for. The source of the geocode data comes from Google! I was going to ignore this and move on with the locations that were successfully geocoded but I can't/don't want to let this go. Does anyone have any insight why the geocode function is behaving this way?
Thank you!
Removing the spaces before the commas might help:
dataset <- read.table(text ="fullAddress
'109 Bennett Dr, Caribou, ME 4736'
'1201 S Main St, Ann Arbor, MI 48104'
'2679 Ann Arbor Saline Rd, Ann Arbor, MI 48103'",
stringsAsFactors = F, header = T, quote = "'", sep = ",")
If I call mutate_geocode()
on the first row I get the desired results:
fullAddress lon lat
1 109 Bennett Dr, Caribou, ME 4736 -68.0041 46.86837
If you keep getting geocode failed with status OVER_QUERY_LIMIT
errors, then check this other question: Getting OVER QUERY LIMIT after one request with geocode