我正在使用以下脚本安装一些软件包。除软件包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.tableinstall.packages("data.table", type = "source",
repos = "http://Rdatatable.github.io/data.table")
这也失败。
我也尝试使用下面的方法,它也失败了->
library(devtools)
install_github("Rdatatable/data.table", build_vignettes=FALSE)