stats_noob
stats_noob

Reputation: 5897

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?

Upvotes: 3

Views: 3926

Answers (4)

IRTFM
IRTFM

Reputation: 263301

That package was in support of a book published in 2010. The author published a second edition in 2017 and the current version of the support package is https://cran.r-project.org/web/packages/DMwR2/index.html

It does have currently CRAN-hosted source and binary packages, and doesn't need compilation, so it should be able to be installed with:

install.packages("DMwR2", dependencies=TRUE)

You can get the most recent version by following the directions at the Github site:

library(devtools)  # You need to install this package!
install_github("ltorgo/DMwR2",ref="develop")

Those are much more likely to run properly with recent versions of R.

Upvotes: 2

Ben Bolker
Ben Bolker

Reputation: 226057

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).

Upvotes: 8

akrun
akrun

Reputation: 886938

Had the same message on R 4.1.0

install.packages("DMwR")
Warning message:
package ‘DMwR’ is not available for this version of R

An option is also to create a checkpoint. According to the CRAN package website, it is archived on '2021-03-16'. So, we could use the checkpoint one day before that date

library(checkpoint)
checkpoint("2021-03-15")
install.packages("DMwR")
library(DMwR)
#Loading required package: lattice
#Loading required package: grid
#Registered S3 method overwritten by 'quantmod':
#  method            from
#  as.zoo.data.frame zoo 

The checkpoint can be deleted as well

delete_all_checkpoints()

Upvotes: 5

jared_mamrot
jared_mamrot

Reputation: 26484

You can install it from the CRAN github mirror (despite it being removed from CRAN), e.g.

library(devtools)
install_github("cran/DMwR")

Upvotes: 3

Related Questions