无法在R中安装tidyverse软件包。错误没有调用任何软件包

时间:2019-03-24 00:39:24

标签: r installation rstudio tidyverse

我正在尝试在R studio中安装软件包tidy verse并收到这些错误。

> install.packages('tidyverse')
also installing the dependency ‘rstudioapi’

  There is a binary version available but the source version is later:
           binary source needs_compilation
rstudioapi  0.9.0   0.10             FALSE

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/tidyverse_1.2.1.tgz'
Content type 'application/x-gzip' length 88754 bytes (86 KB)
==================================================
downloaded 86 KB


The downloaded binary packages are in
    /var/folders/kn/b21xc36111z157czpz0swc900000gn/T//RtmpeVGvVh/downloaded_packages
installing the source package ‘rstudioapi’

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

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘assertthat’
Calls: time.to ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Warning in install.packages :
  installation of package ‘rstudioapi’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/kn/b21xc36111z157czpz0swc900000gn/T/RtmpeVGvVh/downloaded_packages’

此外,我还尝试安装在base R中并收到相同的消息。我去了临时文件夹,解压缩了程序包,然后将其移到库文件夹中。当我尝试library(assertthat)时,出现一个错误,即没有安装有效的软件包。

我以前已经在此计算机上成功安装了tidyverse,但是这次尝试使用它时,它告诉我它尚未安装,因此我尝试重新安装它。

2 个答案:

答案 0 :(得分:0)

我删除了.Rhistory,.Rdata和.Rprofile文件,重新启动了R,并且能够毫无问题地安装tidyverse

答案 1 :(得分:0)

我重新启动了计算机并使用 install.packages("devtools") 安装了 devtools。

在那之后,我确保将 Rtools 放在 PATH 上,只需按照此处的说明进行操作:Using Rtools40 on Windows

之后,我可以使用 install.packages("tidyverse") 安装 tidyverse。