3

I am using below script to install some packages. All the packages are getting installed except package 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)

What should i do to install data.table package in R3.5.1 in mac?

Error messages i got are:

* 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’

I also tried installing data.table using ->

install.packages("data.table", type = "source",
    repos = "http://Rdatatable.github.io/data.table")

This also fails.

I also tried using below and it fails too->

library(devtools)
install_github("Rdatatable/data.table", build_vignettes=FALSE)
zubug55
  • 729
  • 7
  • 27

0 Answers0