Downgrade R Version and R Package Bioconductor

Downgrade R version and R package Bioconductor

Generally, Bioconductor is designed to work with specific versions of R, so there are no guarantees associated with using older versions of Bioconductor (or any R package) with newer versions of R. Better to ask questions about Bioconductor packages on the Bioconductor mailing list. Probably what you're saying is that there is some problem with your current Bioconductor installation, and what you'd really be better of doing is fixing the problem.

Check out the LibPath of installed.packages(), and compare to the output of .libPaths(). I have

> head(installed.packages()[,"LibPath"], 1)
affy
"/home/mtmorgan/R/x86_64-unknown-linux-gnu-library/3.0"
> .libPaths()
[1] "/home/mtmorgan/R/x86_64-unknown-linux-gnu-library/3.0"
[2] "/home/mtmorgan/bin/R-3-0-branch/library"

Good news! All my Bioc packages are in a specific library. I could then arrange (see ?.libPaths) to start R with .libPaths pointing to a new location for Bioc 2.12 packages, e.g.,

R_LIBS_USER="/home/mtmorgan/R/x86_64-unknown-linux-gnu-library/3.0-2.12" R

then explicitly install the version of the BiocInstaller package I want to use, e.g.,

install.packages("BiocInstaller", 
repos="http://bioconductor.org/packages/2.12/bioc")

and library(BiocInstaller); biocLite() as usual.

If my Bioconductor packages were installed in the R home directory, then I'd remove.packages() instead of setting .libPaths(), or I'd run BiocInstaller::biocValid() and follow the directions for reverting "too new" packages.

Downgrade R version (no issues with Bioconductor installation)

As point by @Deleet, this is FOR WINDOWS ONLY.

For the rest of the platforms, see: https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop


Go to: Tools > Global Options > press the "Change" button (marked in Yellow) >

Sample Image

Select the version you want to use:

Sample Image

OK > OK > Apply > Restart R

R how to install a specified version of a bioconductor package?

Bioconductor stores the package archives here: https://bioconductor.org/packages/3.6/bioc/src/contrib/Archive/

1) Locate and download the version you would like to install.

2) Install it using R CMD INSTALL yourpackage_version_x.y.z.tar.gz as
suggested by Eugène Adell in the comments.

If you cannot find the specific version on the bioconductor archive, then try to find it on the github repository of the package.

Installing packages using BiocConductor instead of BiocLite

Probably best to ask this on the Bioconductor support site https://support.bioconductor.org.

I'd suggest

## we need BiocManager from CRAN
if (!"BiocManager" %in% rownames(installed.packages()))
install.packages("BiocManager", repos = "https://cran.r-project.org")

## install or update required packages
.bioc_packages <- c("dada2", "phyloseq", "DECIPHER", "phangorn")
BiocManager::install(.bioc_packages)

This will install all packages (and their dependencies) that are not already installed, will update any packages that are not current (for the release of Bioconductor that you are using -- per Bioconductor guidelines, these will be bug fixes only), and will say that it will not re-install packages that are already installed with their current version.

Note that with R-4.1.2 you will not get the most recent version of Bioconductor. You might update to R-4.2.1 (because you want to be using current versions of these packages, and because you might want to do other analyses in Bioconductor involving packages that have been introduced since the Bioconductor version available with R-4.1.2) or downgrade to the R version used in the paper you cite (because you want to more closely reproduce results from the paper).

wrong R version installed during dockerization

FROM r-base:3.4.4 correctly installs R version 3.4.4, but your apt install -y libcurl4-openssl-dev then updates it to the latest version (which is 3.5.1).

You can test this interactively. Start with a very simple one-line Dockerfile:

FROM r-base:3.4.4

Build it as docker build -t tester . and run it interactively as docker run -it --entrypoint /bin/bash tester:

root@0f5bb0fb300e:/# R --version | grep "R version"
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"

So far so good! Let's run the next couple of lines of your Dockerfile:

root@0f5bb0fb300e:/# apt update
Get:1 http://cdn-fastly.deb.debian.org/debian testing InRelease [150 kB]
...
root@0f5bb0fb300e:/# apt install libcurl4-openssl-dev
...
The following packages will be upgraded:
r-base-core r-cran-boot r-cran-class r-cran-codetools r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-mgcv r-cran-nnet r-cran-rpart r-cran-spatial
...

Because your Dockerfile runs this last command with the -y flag, docker build automatically consents to upgrading R to the latest version.

Is There a Way to Self-Update r packages that haven't Updated in Years?

One of the reasons for package rot is the CRAN requirement that packages pass the stringent compatibility tests with each R update. You are running a version of R that's almost a year old (despite having a current version of your OS). Some people maintain several versions of R going back years, but most do not. In some case you will be able to download a *.tar.gz version of the package and use either a Terminal-mediated session using" R CMD INSTALL p"/path/to/pkg-name.tag.gz" or using in an R console: install.packages("path/to/pkg-name.tar.gz", repo=NULL, dependencies=TRUE, type="source")

You should of course study the DESCRIPTION file for the pkg and make sure you have need compiler and external system resources available. (Presumably the requirement for a Java runtime environment was in the DESCRPTION file?) The question as it stands might be useful, but it really quite vague in the absence of a specific package to be used for demonstration and testing.

How to install 2 different R versions on Debian?

As I mentioned in comments, this is theoretically possible just like some package families (Emacs, PostgreSQL, ...) allow multiple concurrent versions.

I cannot offer that right now as we use /usr/{share,lib}/R which conflicts. If I were to make that /usr/{share,lib}/R-$version and then use dpkg-alternatives to flip to a default preferred one, we could possibly do it. The problem is the transition. This feature is used by a minority of user, getting to it may introduce bugs for a majority til this is stable. Plus, I do not have the spare time (but if someone else wants to do it, please do so).

In the meantime, you can

  1. possibly use an advanced feature of dpkg and unpack to a local directory rather the default below / -- so /opt/R/oldversions/2.12.1 should be possible. R could even run, you need to redefine $RHOME accordingly.

  2. just build local variants into /usr/local if you really must

  3. if a particular CRAN / non-CRAN package claims to need a particular version of R, fix the damn package already! ;-)

Finally, this is a topic for r-sig-debian as eg the CRAN maintainer Michael and Johannes won't read this thread here.

How to install specific version of rlang package in R?

  1. Maybe try this -- Remove rlang, shutdown and restart R, and then reinstall `rlang'.

  2. If you still want to install a specific version of rlang,

    1) Go to https://cran.r-project.org/src/contrib/Archive/rlang/

    2) Get URL to the specific version you need. (On Chrome, Right click- Copy URL, etc)

    3) Start R, install.packages("[URL]", repo=NULL, type="source")
    e.g install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.2.2.tar.gz", repo=NULL, type="source")

Looking for R version 3.5.2 for Mac

I was able to get version 3.5.2 by modifying the link to download the present version (https://cran.r-project.org/bin/macosx/R-3.6.1.pkg), with the version number I'm interested in (https://cran.r-project.org/bin/macosx/R-3.5.1.pkg). This started an automatic download.



Related Topics



Leave a reply



Submit