Installing a Package Removed from CRAN
Asked Answered
U

4

3

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?

Unprofessional answered 14/6, 2021 at 23:12 Comment(0)
V
8

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).
Volatile answered 14/6, 2021 at 23:32 Comment(4)
thank you for your reply! this seems to have worked!Unprofessional
if either of the answers solved your problem, you're encouraged to click the check-mark to accept itVolatile
@BenBolker I had the same problem and your answer helped me. I just have one question now: how to load the package? library() or require() does not work. my code: remotes::install_version("zeligverse", version="0.1.1") and require(zeligverse)Doralin
You might need to post that at a separate question. My guess is that there are multiple missing packages. If you post as a separate question, make sure to specify exactly what "does not work" means (i.e., what error messages do you get?)Volatile
B
5

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()
Billbug answered 14/6, 2021 at 23:39 Comment(1)
nice, this also provides binaries (unlike the other methods)Volatile
H
3

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

library(devtools)
install_github("cran/DMwR")
Hermes answered 14/6, 2021 at 23:27 Comment(4)
thank you for your reply! when I entered your code, I got this:> remotes::install_version("DMwR", version="0.4.1") Downloading package from url: cran.rstudio.com//src/contrib/Archive/DMwR/DMwR_0.4.1.tar.gz These packages have more recent versions available. It is recommended to update all of them. Which would you like to update? 1: All 2: CRAN packages only 3: None 4: bitops (1.0-6 -> 1.0-7) [CRAN] 5: gtools (3.8.2 -> 3.9.2) [CRAN] 6: curl (4.3 -> 4.3.1) [CRAN] 7: zoo (1.8-8 -> 1.8-9) [CRAN]Unprofessional
I entered "3", but in the end, the "DMwR" library does not show up on the list of packages in R studio. I wonder why?Unprofessional
I updated all out-of-date packages (only gtools on my system) and it installed without error. But @BenBolker's solution looks to have worked, so glad you got it sorted :)Hermes
Thank you everyone for your help!Unprofessional
M
2

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.

Magruder answered 15/6, 2021 at 1:37 Comment(2)
thank you for your reply! I tried to install the "DMwR2" library- it installed successfully! But the "DMwR2" library was missing functions that I needed from the "DMwR" library (e.g. smote()" rdocumentation.org/packages/DMwR/versions/0.4.1/topics/SMOTE )Unprofessional
If that's the only missing algorithm and it doesn't depend on other functions in the earlier package you could just copy it to your version of DMwr2. If it does depend on other functions, you should get an informative error and you could then copy them as well.Magruder

© 2022 - 2024 — McMap. All rights reserved.