问题:无法在下面的R ...代码中安装dplyr。有人提供任何解决方案 我在mac osx sierra和R Version 1.0.136
上> install.packages("dplyr")
There is a binary version available but the source version
is later:
binary source needs_compilation
dplyr 0.5.0 0.7.0 TRUE
Do you want to install from sources the package which needs compilation?
y/n:
y
installing the source package ‘dplyr’
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_0.7.0.tar.gz'
Content type 'application/x-gzip' length 690938 bytes (674 KB)
==================================================
downloaded 674 KB
* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘dplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dplyr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/dplyr’
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/ll/6vx1dr1n5bb9zwbv1z9v53z00000gn/T/RtmpitMpQn/downloaded_packages’
> library(dplyr)
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘DBI’
不确定为什么这不起作用!试图手动下载它也没有(类似/相同的警告/错误)
答案 0 :(得分:5)
昨天,CRAN接受了一个新的dplyr版本。通常CRAN以二进制形式提供Windows和OSX的软件包,但CRAN最多需要48小时才能提供已编译的软件包。
当您尝试在该时间窗口中安装软件包时,R会要求您从源代码安装以前的二进制版本或新版本。如果您决定从源代码安装该版本,则需要使用c ++编译器。
您最简单的方法是安装以前的二进制包,或者等到最新版本在CRAN编译。
结帐https://cran.r-project.org/web/packages/dplyr/index.html以查看您的操作系统的二进制文件是否已经可用。
更新:最新的dplyr
版本似乎存在一些问题,OSX编译似乎失败了。更多信息:https://cran.r-project.org/web/checks/check_results_dplyr.html。我宁愿坚持0.5.0,直到这些问题得到解决。