Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

data.table package in R 3.5 does not install

Tags:

r

data.table

I am currently using R 3.5 (beta version) and I need data.table package in my project but my package does not install. Can anyone help me in the case. It shows me following errors when i install it.

install.packages("data.table") Installing package into ‘C:/Users/hp/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘data.table’ These will not be installed

I had also tried to install the package data.table_1.10.4-3.zip using CRAN repository. but it shows following errors.

install.packages("C:/Users/hp/Downloads/data.table_1.10.4-3.zip", repos = NULL, type = "win.binary") Installing package into ‘C:/Users/hp/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) package ‘data.table’ successfully unpacked and MD5 sums checked library(data.table) Error: package or namespace load failed for ‘data.table’: package ‘data.table’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version

Can anyone help me? What should I do?

like image 451
Rishabh Raj Avatar asked Apr 15 '18 04:04

Rishabh Raj


People also ask

Why I Cannot install package in R?

Changing the configuration in R Studio to solve install packages issue. Go To Tools -> Global option -> Packages. Then uncheck the option “Use secure download method for HTTP”. For other RStudio issues refer to official Troubleshooting Guide here.

How do I install an R data package?

Open R via your preferred method (icon on desktop, Start Menu, dock, etc.) Click “Packages” in the top menu then click “Install package(s)”. Choose a mirror that is closest to your geographical location. Now you get to choose which packages you want to install.

How do I manually install a package in R?

Go into R, click on Packages (at the top of the R console), then click on "Install package(s) from local zip files", then find the zip file with arm from wherever you just saved it. Do the same thing to install each of the other packages you want to install.


4 Answers

Update: data.table 1.11.0 was accepted on CRAN 1st May 2018. CRAN binaries should now start to update over the next few days.


Previous answer:

data.table 1.10.4-3 (Oct 2017) has been in error status for some months on CRAN which prevents the binaries being made available, very reasonably. We have fixed the problems in dev in good time months ago and just need to get the next release to CRAN. It is not a problem of CRAN or of R 3.5.0, per se.

In the meantime, could you use Windows.zip binary from dev? It is compiled for you and you don't need any tools. This dev version 1.10.5 is what will be renamed to 1.11.0 on CRAN. There is nothing in it that won't be in 1.11.0 so there is no addition risk, other than it not actually being on CRAN yet.

https://twitter.com/MattDowle/status/976890741543677952

enter image description here

like image 136
Matt Dowle Avatar answered Oct 19 '22 11:10

Matt Dowle


It seems that in Windows, prior RTools versions (sometimes?) installed to the directory C:\\RBuildTools, instead of the proper C:\\RTools directory, and this is causing problems. With R 3.5.0, RTools is needed to load the data.table package from source.

RTools35.exe IS compatable with R 3.5.0 and will install data.table once it is installed correctly. I'm using the CRAN versions of data.table and R 3.5.0.

I finally got data.table to install by fixing the RTools installation and PATH:

  1. uninstall RTools

  2. MANUALLY removing the old C:\\RBuildTools directory from the PATH

  3. (re)installing RTools35 to C:\\RTools directory. (make sure to choose the "add to path" option.

  4. double check in R that the new directory (c:\\Rtools\\bin) is in the PATH by running the command in R Sys.getenv("PATH").

see this RStudio Communitydiscussion which was helpful in figuring this out.

and also several suggestions filed under an issue on data.table github issues especially one nicely spelled out by JoeFernando

like image 22
Matt L. Avatar answered Oct 19 '22 11:10

Matt L.


R 3.5 is currently in pre-release. If you look at the data.table page https://cran.r-project.org/web/packages/data.table/index.html at the time being the data.table package has not been compiled for R 3.5 on windows. Thus you cannot install it with 3.5. Maybe you can compile it yourself. But if the CRAN did not make a windows binary for the R 3.5 maybe something went wrong.

The new R version seems to have some major internal changes. Thus, when you tried to install a previous data.table version compiled for R 3.4, R 3.5 told you that you can't.

You should really use the stable R 3.4 for now.

Edit on April 25th 2018: R 3.5 is now released. But the data.table package is still unavailable for R 3.5.

like image 4
JRR Avatar answered Oct 19 '22 12:10

JRR


To elaborate more on Matt Dowle's answer in case someone is less familiar with the procedure:

  • Go to AppVeyor's website and download the windows.zip binary file data.table_1.10.5.zip: https://ci.appveyor.com/project/Rdatatable/data-table/build/job/x3k2tntvn25hq7jh/artifacts

  • In RStudio, under Tools, click "Install.Packages".

  • Choose Package Archive File.

  • Browse and choose data.table_1.10.5.zip you just downloaded. Click Install

It worked for me.

like image 4
Xing Zhang Avatar answered Oct 19 '22 10:10

Xing Zhang