包dplyr和choroplethr不兼容

包dplyr和choroplethr不兼容,r,dplyr,choroplethr,R,Dplyr,Choroplethr,运行下面的代码可以工作 library(dplyr) mtcars %>% group_by(cyl) %>% summarise (mean_mpg = mean(mpg)) #一个tibble:3x2 cyl mean_mpg <dbl> <dbl> 1 4 26.66364 2 6 19.74286 3 8 15.10000 看起来这两个包不兼容。我以前使用过它们,没有任何问题,但升级到新版本的R、RStud

运行下面的代码可以工作

library(dplyr)

mtcars %>% 
 group_by(cyl) %>% 
 summarise (mean_mpg = mean(mpg))
#一个tibble:3x2

 cyl mean_mpg
<dbl>    <dbl>
1     4 26.66364
2     6 19.74286
3     8 15.10000

看起来这两个包不兼容。我以前使用过它们,没有任何问题,但升级到新版本的R、RStudio和这两个软件包后,它们就不能一起工作了。

当您加载
choroplethr
时,它也会加载
plyr
。正如人们一再提到的,在加载
dplyr
之后,不要加载
plyr

在您的情况下,先加载
choroplethr
,然后加载
dplyr
,一切都会正常工作

library(choroplethr)
Loading required package: acs
Loading required package: stringr
Loading required package: plyr
Loading required package: XML

Attaching package: ‘acs’

The following object is masked from ‘package:base’:

    apply

虽然
choroplethr
仅取决于
acs
acs
取决于
plyr
;因此,当您检查
choroplethr
CRAN页面时,可能不太清楚它是否也加载了
plyr

谢谢,这很有效。我以前以其他顺序加载它(dplyr然后是choroplethr),没有任何问题,但现在加载顺序必须颠倒。是的,choroplethr的这个“功能”是在版本3.5.2中引入的:。关于它,我能说的唯一一件好事是,它解决了似乎没有人能够充分解释的更糟糕的问题。我真的很讨厌choroplethr现在依赖acs。但至少在当时,我在博客文章中概述的问题似乎没有其他解决办法。
library(choroplethr)
Loading required package: acs
Loading required package: stringr
Loading required package: plyr
Loading required package: XML

Attaching package: ‘acs’

The following object is masked from ‘package:base’:

    apply