r - 无法在 R 3.5.1 中安装包 data.table
问题描述
我正在使用下面的脚本来安装一些软件包。除包 data.table 外,所有包都已安装。
# ipak function: install and load multiple R packages.
# check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE, repos='http://cran.rstudio.com/')
sapply(pkg, require, character.only = TRUE)
}
# usage
list.of.packages <- c("curl", "methods", "jsonlite", "tseries", "forecast", "sweep","timetk","tidyquant","data.table","stringr","httr","zoo","lubridate","tidyr","tidyverse","forecastHybrid")
ipak(list.of.packages)
我应该怎么做才能在 Mac 的 R3.5.1 中安装 data.table 包?
我得到的错误信息是:
* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c assign.c -o assign.o
clang: error: unsupported option '-fopenmp'
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/data.table’
Warning messages:
1: In install.packages(new.pkg, dependencies = TRUE, repos = "http://cran.rstudio.com/") :
installation of package ‘data.table’ had non-zero exit status
2: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘data.table’
我还尝试使用 -> 安装 data.table
install.packages("data.table", type = "source",
repos = "http://Rdatatable.github.io/data.table")
这也失败了。
我也尝试在下面使用它也失败了->
library(devtools)
install_github("Rdatatable/data.table", build_vignettes=FALSE)
解决方案
推荐阅读
- c++ - 数百行来自else if语句的垃圾代码
- excel - 仅使用 VBA 到 PDF 的工作表中填充的打印区域
- java - 如何在没有源代码的情况下修改 JAR 中的方法?
- java - 添加 ; 的影响 在for循环语句之后?
- visual-studio-code - 在显示门洛字体系列时使用 vscode 出现问题
- google-apps-script - Google 表格的时间戳脚本
- node.js - 节点 imap - 不稳定的互联网连接和套接字错误
- java - 从 Java 中退出浏览器
- hsqldb - 如何知道 Hsqldb "MERGE INTO" 是否进行了插入或更新
- c - 如何在 OpenMP 中实现 MPI_MINLOC?