I’m using google maps API and ggmap to create a simple map of NYC in an RMarkdown document, in R:
install.packages("ggmap")
ggmap::register_google(key = "<your-api-key>", write = TRUE)
library(ggmap)
get_googlemap(center = "New York") %>% ggmap()
Since I’ll be updating this RMarkdown frequently and running this code over and over, how do I avoid incurring potential cost w/ the google API? Basically, I only need to create the map once with a single API call, and I don’t want this API call to run over and over every time I run the RMarkdown “knit to HTML option”.
Is there a best practice for how to save the ggmap as an object so that I’m not reliant on the API call every time?
Thanks in advance.