2

if you could help me please with a solution to a simple question :

i believe that my ubuntu machine automatically installed R 3.6.0 : when i type : > R. it says :

R version 3.6.0 (2019-04-26) -- "Planting of a Tree" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)

However, I need to use a previous version of R, namely R 3.5, that was installed and did run on my Ubuntu machine, and I can see lots of folders in the directory (a long list follows below) :

/home/bogdan/R/x86_64-pc-linux-gnu-library/3.5

Please would you advise how can I revert to R 3.5 instead of using R 3.6 . Thanks a lot,

bogdan

ps : the list of folders in ~/R/x86_64-pc-linux-gnu-library/3.5 consists of 453 elements.

abind/
acepack/
ALL/
alphahull/
amap/
annotate/
AnnotationDbi/
AnnotationFilter/
AnnotationForge/
apcluster/
ape/
aroma.light/
askpass/
assertthat/
backports/
base64enc/
bbmle/
beachmat/
beeswarm/
BH/
bibtex/
bindr/
bindrcpp/
Biobase/
BiocFileCache/
BiocGenerics/
biocGraph/
BiocInstaller/
BiocManager/
BiocNeighbors/
BiocParallel/
BiocStyle/
BiocVersion/
biocViews/
biomaRt/
Biostrings/
biovizBase/
bit/
bit64/
bitops/
bladderbatch/
blob/
bookdown/
brew/
broom/
BSgenome/
Cairo/
callr/
car/
carData/
Category/
caTools/
CCA/
CCP/
cellranger/
cellrangerRkit/
checkmate/
circlize/
cli/
clipr/
clisymbols/
coda/
colorspace/
combinat/
ComplexHeatmap/
contfrac/
corpcor/
corrplot/
cowplot/
crayon/
crosstalk/
cubature/
curl/
cvTools/
data.table/
DBI/
dbplyr/
DDRTree/
DelayedArray/
DelayedMatrixStats/
deldir/
densityClust/
DEoptimR/
desc/
DESeq/
DESeq2/
deSolve/
destiny/
devtools/
dichromat/
digest/
diptest/
distillery/
doBy/
docopt/
doParallel/
doRNG/
doSNOW/
dotCall64/
dplyr/
DropletUtils/
dtw/
dynamicTreeCut/
e1071/
EDASeq/
edgeR/
ellipse/
ellipsis/
elliptic/
EnrichmentBrowser/
enrichR/
EnsDb.Hsapiens.v86/
EnsDb.Mmusculus.v79/
ensembldb/
evaluate/
extRemes/
fansi/
fastcluster/
fastICA/
fda/
fields/
fitdistrplus/
fit.models/
flexmix/
FNN/
forcats/
foreach/
formatR/
Formula/
fpc/
fs/
futile.logger/
futile.options/
gage/
gbRd/
gdata/
genefilter/
geneplotter/
generics/
GenomeInfoDb/
GenomeInfoDbData/
GenomicAlignments/
GenomicFeatures/
GenomicRanges/
GEOquery/
GetoptLong/
GGally/
ggbeeswarm/
ggbio/
ggdendro/
ggfortify/
ggplot2/
ggrepel/
ggridges/
ggthemes/
gh/
git2r/
githubinstall/
Glimma/
GlobalOptions/
glue/
gmodels/
GO.db/
goftest/
googleVis/
GOplot/
GOstats/
gplots/
graph/
graphite/
gridExtra/
GSA/
GSEABase/
gtable/
gtools/
hash/
haven/
HDF5Array/
hdf5r/
hexbin/
highr/
Hmisc/
hms/
HSMMSingleCell/
htmlTable/
htmltools/
htmlwidgets/
httpuv/
httr/
hwriter/
hypergeo/
ica/
igraph/
impute/
ini/
inline/
IRanges/
irlba/
iterators/
jsonlite/
kBET/
KEGGgraph/
KEGGREST/
kernlab/
knitr/
labeling/
laeken/
lambda.r/
lars/
later/
latticeExtra/
lazyeval/
limma/
Linnorm/
lle/
lme4/
Lmoments/
lmtest/
locfit/
loo/
lsei/
lubridate/
M3Drop/
magrittr/
maps/
maptools/
markdown/
MAST/
Matrix/
MatrixModels/
matrixStats/
mclust/
MCMCglmm/
memoise/
metap/
mime/
minqa/
mixtools/
mnormt/
mockery/
modelr/
modeltools/
moments/
monocle/
munsell/
Mus.musculus/
mvoutlier/
mvtnorm/
NADA/
nloptr/
npsurv/
numDeriv/
openssl/
openxlsx/
OrganismDbi/
org.Hs.eg.db/
org.Mm.eg.db/
orthopolynom/
ouija/
packrat/
pathview/
pbapply/
pbkrtest/
pcaMethods/
pcaPP/
pcaReduce/
penalized/
permute/
PFAM.db/
pheatmap/
pillar/
pkgbuild/
pkgconfig/
pkgload/
pkgmaker/
PKI/
plogr/
plotly/
pls/
plyr/
plyranges/
png/
polyclip/
polynom/
prabclus/
praise/
preprocessCore/
prettyunits/
processx/
progress/
promises/
ProtGenerics/
proxy/
pryr/
ps/
purrr/
qlcMatrix/
quantreg/
R6/
randomForest/
ranger/
RANN/
rappdirs/
RBGL/
rcmdcheck/
RColorBrewer/
Rcpp/
RcppAnnoy/
RcppArmadillo/
RcppEigen/
RcppProgress/
RCurl/
Rdpack/
readr/
readxl/
refGenome/
registry/
reldist/
rematch/
remotes/
ReportingTools/
reprex/
reshape/
reshape2/
reticulate/
Rgraphviz/
rhdf5/
Rhdf5lib/
rio/
rJava/
rjson/
RJSONIO/
rlang/
RMariaDB/
rmarkdown/
R.methodsS3/
Rmisc/
RMTstat/
rngtools/
robCompositions/
robust/
robustbase/
ROCR/
R.oo/
Rook/
rprojroot/
rrcov/
Rsamtools/
rsconnect/
RSQLite/
rstan/
rstudioapi/
rsvd/
rtracklayer/
Rtsne/
RUnit/
R.utils/
RUVSeq/
rvest/
S4Vectors/
safe/
SC3/
scales/
scater/
scatterplot3d/
scde/
scfind/
scImpute/
scmap/
SCnorm/
scran/
scRNAseq/
scRNA.seq.funcs/
SDMTools/
segmented/
selectr/
sessioninfo/
Seurat/
sgeostat/
shape/
shiny/
ShortRead/
SingleCellExperiment/
slam/
SLICER/
smoother/
snow/
snowfall/
sourcetools/
sp/
spam/
SparseM/
sparsesvd/
spatstat/
spatstat.data/
spatstat.utils/
SPIA/
splancs/
sROC/
StanHeaders/
statmod/
stringi/
stringr/
SummarizedExperiment/
sva/
sys/
tensor/
tensorA/
testthat/
tibble/
tidyr/
tidyselect/
tidyverse/
tinytex/
topGO/
trimcluster/
tripack/
truncnorm/
TSCAN/
tsne/
TTR/
TxDb.Mmusculus.UCSC.mm10.ensGene/
TxDb.Mmusculus.UCSC.mm10.knownGene/
UpSetR/
usethis/
utf8/
VariantAnnotation/
vcd/
vegan/
VennDiagram/
Vennerable/
venneuler/
VGAM/
VIM/
vipor/
viridis/
viridisLite/
WGCNA/
whisker/
withr/
WriteXLS/
xfun/
XML/
xml2/
xopen/
xtable/
xts/
XVector/
yaml/
zCompositions/
zip/
zlibbioc/
zoo

ps2: shall I do :

$apt-cache policy r-base

r-base:
  Installed: 3.6.0-1xenial
  Candidate: 3.6.0-2xenial
  Version table:
     3.6.0-2xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
 *** 3.6.0-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
        100 /var/lib/dpkg/status
     3.5.3-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.2-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.1-2xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.1-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.0-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.2.3-4 500
        500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/universe i386 Packages
0

1 Answer 1

0

At first we need to save the list of all R-related packages with command below:

dpkg -l | grep "^ii  r-" > r_packages.txt

To get R 3.5 on Ubuntu 16.04 LTS we need to add CRAN repository with:

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update

Then we need to adjust APT to the highest priority of R 3.5.x versions for the CRAN repository with long single command:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-r35
Package: r-*
Pin: release a=xenial-cran35
Pin: version 3.5*
Pin-Priority: 800

Package: r-cran-nlme
Pin: release a=xenial-cran35
Pin: version 3.1.139-1xenial0
Pin-Priority: 800

Package: r-cran-cluster
Pin: release a=xenial-cran35
Pin: version 2.0.8-1xenial0
Pin-Priority: 800
EOF

Purge all R-packages with (ensure that r_packages.txt was saved before):

sudo apt-get purge r-*
sudo apt-get autoremove

Then reinstall the list of R packages from saved r_packages.txt list while filtering it on 3.6 version with the command below:

sudo apt-get install $(cat r_packages.txt | grep "3.6" | awk '{print $2}')

and optionally install all packages (i.e. without filter) too with:

sudo apt-get install $(cat r_packages.txt | awk '{print $2}')

And finally check that R version is 3.5:

$ R

R version 3.5.3 (2019-03-11) -- "Great Truth"

Notes:

  1. I have checked this method on clean Ubuntu 16.04 LTS VM with two essential R packages installed - r-base and r-base-dev (and their dependencies).
  2. If you want to revert to R 3.6 - then simply remove pin/lock file with sudo rm /etc/apt/preferences.d/pin-r35 and run sudo apt-get dist-upgrade to get the newest dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.