Installing a Package Removed from CRAN - r

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?

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

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

You can install it from the CRAN github mirror (despite it being removed from CRAN), e.g.
library(devtools)
install_github("cran/DMwR")

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.

Related

Why is R unable to access index for repository of bioconductor

When trying to install bioconductor (for installing phyloseq package) I get several warning and error messages
I got a new harddrive few days ago so I had to reinstall all programs including R with all the packages I usally need. Everything worked fine until I tried bioconductor.
I am using the rcommended code which worked out for me before:
source('http://bioconductor.org/biocLite.R')
biocLite('phyloseq')
The error message I get is:
Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.6.0 (2019-04-26).
installation path not writeable, unable to update packages: cluster,
nlme Updating packages 'bipartite' Warning: unable to access index for
repository
https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6:
cannot open URL
'https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6/PACKAGES
So apparently there are several problems?
Some packages cant be updated due to wrong libpath and
R is not able the open the bioconductor hompage
Thanks for your suggestions!
Bioconductor is tied to particular versions of R. You're trying to use a version of Bioconductor (3.7) on a version of R (3.6) that does not match. There is a map between versions, but the underlying problem is that you're using your R-3.5 libraries hoping that they'll work in R-3.6. You should instead 'start over' with an R-3.6 specific installation. In addition, 'BiocInstaller' has been replaced with BiocManager; your 'recommended code' is out of date, as shown on package landing pages.
If you want to continue using your previous library installation (note that this is a one-way street -- you're giving up on your usable R-3.5 installation), try removing ALL versions of the BiocVersion and BiocInstaller packages. .
remove.packages(c("BiocVersion", "BiocInstaller")) # repeat 'till all removed
Either starting with a new library or after removing previous versions of BiocVersion / BiocInstaller, install BiocManager from CRAN
install.packages("BiocManager")
and go about your business
BiocManager::install("phyloseq")
Make sure to validate your installation, so that you do not mix packages from different Bioconductor versions
BiocManager::valid()
Check out current package landing pages, e.g., for phyloseq, or the installation page.

How to install "RTAQ" package in R

How to install "RTAQ" package in R?
I found a website with 4 packages I need, but I can't download "RTAQ" file.(
http://r-forge.r-project.org/R/?group_id=316 )
This command below is invalid too.
install.packages("RTAQ", repos="http://R-Forge.R-project.org")
Warning in install.packages :
package ‘RTAQ’ is not available (for R version 3.4.4)
RTAQ has been archived from CRAN, since CRAN was unable to receive a clean update of the software since November 2012. For details, see the following message on the CRAN RTAQ page.
If you want to use RTAQ, you'll need to install an older version of R that is compatible with RTAQ, and use RTAQ with that version of R.

install quantstrat for R latest R version ()

I would like to install a package when using the latest R version in RStudio.
In particular the quantstrat package
Is that possible?
This is the R latest version I have 3.4.1
my error message:
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.4.1)
Because quantstrat build-fail at R-Forge, you can't get the pre-build file(.tar.gz). You can get the code from github and build by yourself.
install.packages("devtools")
require(devtools)
install_github("braverock/blotter") # dependency
install_github("braverock/quantstrat")
Can you provide the installation code that produced that error message? Are you trying to install it from CRAN?
That doesn't appear possible.
A post from 2014 states it's not on CRAN
quantstrat is a R package ... still under heavy development and can’t be installed from CRAN yet. You can install it from source and the process is straightforward.
It's not on the current list of available CRAN packages
It's R-Forge page states the current version 'Failed to build'.
You could download the previous version (and its dependency) from R-Forge at
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/quantstrat_0.9.1739.zip and
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/blotter_0.9.1741.zip
(or get the Linux tar.gz files). Assuming they're saved in your personal Downloads folder, install it in R with
install.packages("~/Downloads/blotter_0.9.1741.zip", repos = NULL)
install.packages("~/Downloads/quantstrat_0.9.1739.zip", repos = NULL)
According to that first link, you'll need to install these prereqs first, if they're not already:
install.packages("FinancialInstrument")
install.packages("PerformanceAnalytics")
install.packages("foreach")
Edit: see the comment below from #brian-g-peterson for how the current deployment avenue uses GitHub. https://github.com/braverock/quantstrat

How to force older packages to install on newer versions of R?

I cannot install proj4string into my current version of R (2.15.1):
Warning message:
package ‘proj4string’ is not available (for R version 2.15.1)
I assume this is because 2.15.1 is fairly new and the package just hasn't been updated. Is there a general mechanism for forcing R to install an older version of a binary package (realizing that there may be bugs that result)?
(upgraded from a comment)
Download the relevant package (zip, tarball, whatever) from the archives and install it locally, e.g.
install.packages("proj4string_x.y.z.zip",repos=NULL)
(this is not literal: x.y.z represents the package version)
sorry to bump this post again, but i had the same problem . then i found that I can use the following lines for the package:
install.packages("devtools")
devtools::install_github("slowkow/ggrepel")
replaced "slowkow/ggrepel" by the package and github repo.
What i noticed that many packages on github will have details to that. Hope that helps.
You can use install_version from the package devtools to install a specific package version.
To find the package version:
Search for the CRAN page of the package. E.g. for ggmap it is https://CRAN.R-project.org/package=ggmap
Check the archived packages. See heading "Downloads" and "Old Sources:"
Example code for package ggmap
devtools::install_version(
"ggmap",
version = "2.6",
repos = "http://cran.us.r-project.org"
)

Cannot find tseries package from CRAN mirror

I'm trying to install the tseries package on my Linux machine. Under R, I ran
> install.packages("tseries")
I was prompted with a list of mirror sites, but no matter which one I chose (for example, 79: USA (WA)), it gave me
Selection: 79
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package "tseries" is not available
Does anyone know why that might be? My R version is 2.9.2. Thx.
CRAN archives are versioned. And as the CRAN package page for tseries clearly shows, it now requires an R version of at 2.10.0 or later. So
either you upgrade R which is a good idea anyway as your version is two years old
or you stick with your version, but grab an older version of tseries from its archive on CRAN

Resources