我正在尝试从ggmap教程中复制一个示例。这是代码:
library(dplyr)
library(forcats)
`%notin%` <- function(lhs, rhs) !(lhs %in% rhs)
violent_crimes <- crime %>%
filter(
offense %notin% c("auto theft", "theft", "burglary"),
-95.39681 <= lon & lon <= -95.34188,
29.73631 <= lat & lat <= 29.78400
) %>%
mutate(
offense = fct_drop(offense),
offense = fct_relevel(offense,
c("robbery", "aggravated assault", "rape", "murder")
)
)
qmplot(lon, lat, data = violent_crimes, maptype = "toner-lite", color = I("red"))
我得到的只是一个错误,内容如下:
Error in match(names(x), .all_aesthetics) : object '.all_aesthetics' not found
我正在使用ggmap 2.6.1版
答案 0 :(得分:1)
我找到了解决方案。我遇到的问题是由于ggmap
软件包的最新版本导致的。根据{{3}}的建议,我决定更新ggmap
软件包。事实证明,已经从GitHub安装了devtools::install_github("dkahle/ggmap")
的情况下,ggplot2
无法做到这一点。正如在此camille中所指出的,我去降级了ggplot2
到CRAN(3.0.0)可用的版本,并且从GitHub安装ggmap
没有问题。