shiny app gets '400 Bad Request' trying to get data from google api

1.4k Views Asked by At

As part of my shiny app I call geocode() from the ggmap R package.
The data is geocoded and gets a result - i can see that from my console trying to run the app locally and from the log on the shinyapps.io dash board.
After the end of the geocode i get the next message:

.Warning in readLines(connect) :
  cannot open: HTTP status was '400 Bad Request'
Error in readLines(connect) : cannot open the connection  

have a clue?

2

There are 2 best solutions below

0
On BEST ANSWER

So It turns out it has nothing to do with shiny the problam was with sending the data to google's geocode.

When I read in the data I used read.table(). Some of the addresses had an apostrophe ' in them, so it read it as a new line in the same cell (I don't really know why).

I changed the data reading to use read.csv() and it worked fine.

0
On

In read.table() default argument for quote is ' in read.csv it is different. Read more about arguments of data input R: Data Input