ggmap qmplot() 对象 '.all_aesthetics' 未找到
ggmap qmplot() object '.all_aesthetics' not found
我正在尝试复制 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
我找到了解决办法。我遇到的问题是由于 ggmap
包的版本不是最新的。根据 I decided to update the ggmap
package. It turns out that it can't be done with devtools::install_github("dkahle/ggmap")
while ggplot2
has been installed from GitHub. As pointed out in this thread 的建议,我将 ggplot2
降级到 CRAN (3.0.0) 上可用的版本,并且从 GitHub.
安装 ggmap
没有问题
我正在尝试复制 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
我找到了解决办法。我遇到的问题是由于 ggmap
包的版本不是最新的。根据 ggmap
package. It turns out that it can't be done with devtools::install_github("dkahle/ggmap")
while ggplot2
has been installed from GitHub. As pointed out in this thread 的建议,我将 ggplot2
降级到 CRAN (3.0.0) 上可用的版本,并且从 GitHub.
ggmap
没有问题