我想安装tidyverse包使用:install.packages(" tidyverse")。但它给了我下面的错误

时间:2018-04-17 11:46:03

标签: r

install.packages("tidyverse") 
Installing package into ‘/Users/user/Library/R/3.3/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘callr’, ‘reprex’

There are binary versions available but the source versions
  are later:
          binary source needs_compilation
callr      1.0.0  2.0.3             FALSE
tidyverse  1.1.1  1.2.1             FALSE

installing the source packages ‘callr’, ‘reprex’, ‘tidyverse’

trying URL 'https://cran.rstudio.com/src/contrib/callr_2.0.3.tar.gz'
Content type 'application/x-gzip' length 97453 bytes (95 KB)
==================================================
downloaded 95 KB

trying URL 'https://cran.rstudio.com/src/contrib/reprex_0.1.2.tar.gz'
Content type 'application/x-gzip' length 22879 bytes (22 KB)
==================================================
downloaded 22 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘callr’ ...
** package ‘callr’ 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 ‘callr’
* removing ‘/Users/user/Library/R/3.3/library/callr’

Warning in install.packages :
  installation of package ‘callr’ had non-zero exit status

ERROR: dependency ‘callr’ is not available for package ‘reprex’
* removing ‘/Users/user/Library/R/3.3/library/reprex’

Warning in install.packages :
  installation of package ‘reprex’ had non-zero exit status

ERROR: dependency ‘reprex’ is not available for package ‘tidyverse’
* removing ‘/Users/user/Library/R/3.3/library/tidyverse’

Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/mt/kdpgc7xx7nl4wl2g43877jb80000gn/T/RtmpSJkXIU/downloaded_packages’

> library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’

2 个答案:

答案 0 :(得分:2)

您有非零退出状态错误。答案为in another R thread.,这意味着安装过程中出现错误。具体而言,包callrreprex未安装。这些是tidyverse所需的包,随后无法安装。

一般情况下,重新启动计算机并重试后,它对我有用。您还可以在安装callr之前尝试单独安装reprextidyverse个包。

作为最后的手段,您可以在线搜索“tidyverse”功能部分的存档,并手动将其加载到R中。这不会将函数作为包的一部分安装,而是将它们结束到您的全局环境中,以使它们暂时可用。

答案 1 :(得分:0)

我解决了以下问题:

  1. 我将R更新为3.4.4版
  2. 然后我使用:install.packages(" tidyverse",dependencies = TRUE),如下所述:Having trouble installing and loading tidyverse