在 R 中安装 tydiverse 包

在 R 中安装 tydiverse 包

有人知道如何修复这些错误吗?我在 Ubuntu 中安装了 R,这是我在 Mac 电脑上通过 Parallels 获得的。我尝试安装 tidy verse 包,但出现以下错误:

ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/parallels/R/x86_64-pc-linux-gnu-library/3.4/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status

ERROR: dependency ‘httr’ is not available for package ‘rvest’
* removing ‘/home/parallels/R/x86_64-pc-linux-gnu-library/3.4/rvest’
Warning in install.packages :
  installation of package ‘rvest’ had non-zero exit status

ERROR: dependencies ‘httr’, ‘rvest’ are not available for package ‘tidyverse’
* removing ‘/home/parallels/R/x86_64-pc-linux-gnu-library/3.4/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

答案1

R 包通常在 Linux 系统上编译。

所以我们需要安装一些开发工具:

sudo apt-get install build-essential pkg-config r-base-dev

以及用于编译上述 R 包的开发 Ubuntu 包:

sudo apt-get install libxml2-dev libssl-dev libcurl4-openssl-dev

然后您可以运行 R 会话并将包安装到其中:

 $ R
 > install.packages('tidyverse')
 ...
 * DONE (tidyverse)

注意:由于您未指定 Ubuntu 版本,因此此方法在 Ubuntu 16.04 LTS 和 18.04 LTS 上进行了测试。

相关内容