问题
ggmap looks like an excellent package, based on a paper published by David Kahle and Hadley Wickham, "ggmap: Spatial Visualization with ggplot2", The R Journal Vol. 5/1, June 2013, https://journal.r-project.org/archive/2013-1/kahle-wickham.pdf I am using the code published in this article to learn about the package and compare it to RShiny leaflet maps. I started two lines of code on the second page of the article in pdf format, just above Figure 2. There is no formal list of library() requirements, so I used the two most obvious:
library(ggplot2)
library(ggmap)
murder <- subset(crime, offense == "murder")
qmplot(lon, lat, data=murder, colour=I('red'),
size=I(3), darken = 0.3)
The error (in red) followed immediately:
Using zoom = 11... Error: GeomRasterAnn was built with an incompatible version of ggproto. Please reinstall the package that provides this extension.
This looks like a more serious problem than missing a package request, but I may have missed something. Searches using this error statement are not providing any solutions that helped for my case. I have updated all of my R packages, and nothing changed.
回答1:
I finally solved the issue by following every one of the suggestions contained in the links submitted by SymbolixAU. I do not have a complete record of the sequence, but the final step was to move to an older version of ggplot2.
This is an excellent StackOverflow conversation on the same problem, which contains a number of steps. This offers a list of 10 changes. A number of these steps contained its own challenges. The command
devtools::install_github('thomasp85/ggraph')
generated a number of errors. Every one of the errors identified an additional package I had to download. Sorry, but I do not have a list, but I would expect the list to vary across different users.
An ideal solution may have been to work on a number of independent computers and compare possible solutions. I downloaded so many R packages last night that I doubt that all of them were really necessary or helpful.
At this point, several hours of work have enabled me to run two lines of ggmap code from the article. I will try going further, but I cannot promise that the problem is completely solved. One alternative is to set ggmap aside and wait 2-3 months for other programmers to find a better long term solution. We will see.
回答2:
I also followed the steps detailed here and got stuck on the Error in get("f", environment(CoordMap$train)) : object 'f' not found
message for a while. Strangely the thing that solved this for me was this command:
install.packages("ggmap", type = "source")
来源:https://stackoverflow.com/questions/41947045/trying-to-explore-ggmap-following-paper-by-kahle-and-wickham-i-need-geomrastera