I cannot figure out how to make multiple style references in one ggmap()
query from the Google Maps API in R.
Making one query is simple:
library(ggmap)
map <- get_googlemap("new york city",
zoom = 12,
maptype = "roadmap",
style = c(feature = "poi.medical",
element = "geometry",
color = "red"))
ggmap(map)
But let's say I want to make all parks blue as well as hospitals red. How would I go about doing that?
I have tried nested concatenation within my style variable, but that doesn't work. Also, if I make two separate style arguments, I get the following error:
formal argument "style" matched by multiple actual arguments
(For reference, parks are poi.park
in the Google Maps API, element is again "geometry", and color would be "blue".)
In the Google Maps API reference, they state that you can easily make multiple JSON declarations nested within one argument:
Style rules are applied in the order that you specify. Do not combine multiple operations into a single style operation. Instead, define each operation as a separate entry in the style array.
How can I do this in R?
Thanks for any and all help and please, let me know if you have any questions or need any clarification!
See Question&Answers more detail:os