Search code examples
rgithubdata-miningcran

Installing a Package Removed from CRAN


I am using the R programming language. I am trying to install the "Data Mining with R" (DMwR) package. However, when I visit the CRAN website for this package, it seems to be gone:

Package ‘DMwR’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2021-03-16 as check problems were not corrected despite reminders.
A summary of the most recent check results can be obtained from the check results archive.

I visited the Github page for this package

Then, I tried to install this package directly from Github:

> library(devtools)

Loading required package: usethis
Warning message:
package ‘usethis’ was built under R version 4.0.5 

> install_github("Luis Torgo/DMwR")

Error: Failed to install 'unknown package' from GitHub:
  JSON: EXPECTED value GOT <

But this also is not working. Can someone please show me how to install this package?


Solution

  • Besides installing from the CRAN mirror repo, another option is

    remotes::install_version("DMwR", version="0.4.1")
    
    • for this method, you do have to look up the last version in the archive directory (would probably be scrapeable if you wanted to write the code)
    • as with remotes::install_github("cran/<package>"), you will be installing from source, which means that if the package or any of its dependencies have compiled components (in this case it doesn't appear so), you'll need to have development tools (compiler etc.) installed on your system

    A quick word of caution:

    • this will work well if packages have been archived recently, and if the reason for archiving was because the CRAN maintainers are being fussy (that's their prerogative);
    • however, a package may have become incompatible with the rest of the current R ecosystem (R version, dependencies) since its last update - in which case you may find yourself in dependency hell trying to install it (or, worse, your results may be unreliable).