From Leo's Notes
Last edited on 30 December 2021, at 02:11.



To list all installed packages:

> installed.packages()[, c("Package", "LibPath")]

For non-root users, you may need to specify the libpaths so that the installation does not put libraries on the system path (ie. /usr/lib64/R/library. TO do this, create a .Rprofile with the following to save custom libraries to ~/.R/packages:


To remove a package:

> remove.packages("BiocManager")
Removing package from ‘/usr/lib64/R/library’

To update all packages:

> update.packages()
# or
> update.packages( update = TRUE, ask = TRUE )

Install Bioconductor

Installation information available at https://bioconductor.org/packages/release/bioc/html/BiocParallel.html

To install Bioconductor, run:

> BiocManager::install("BiocParallel")

To update packages in Bioconductor, just run install again. If no package is specified, all previously installed packages will be updated.

## Updates all packages
> BiocManager::install()

Multiple packages can be passed:

> BiocManager::install(c("GenomicRanges", "edgeR"))

Installation from source can be specified with type="source":

## install a package from source:
> BiocManager::install("IRanges", type="source")

To update Bioconductor to a different revision, run:

> BiocManager::install(version = "3.10")

#  or for the latest development version
> BiocManager::install(version = "devel")

You can check which version of Bioconductor is installed using:

> BiocManager::version

If you ever get an error like the following:

Error: Bioconductor version '3.8' requires R version '3.5'; see https://bioconductor.org/install

And you are running R version 3.6 or higher, it means that your R packages may be out of date which is causing the installer to use an older version of Bioconductor. Try to update all packages and then try the Bioconductor installation again.


To see the R instance information, such as what packages are installed, libraries, versions, etc. run sessionInfo():

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] BiocManager_1.30.4 compiler_3.6.0     tools_3.6.0

Load a package using the library() function for it to show up as 'attached'.


Package was installed by an R version with different internals

When trying to install a package, I got this error:

Error: package ‘colorspace’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Execution halted
ERROR: lazy loading failed for package ‘munsell’
* removing ‘/gpfs/home/kbrown/R/x86_64-redhat-linux-gnu-library/3.6/munsell’

Try to install the package again. With the issue above, run install.package("colorspace") to fix the immediate problem. However, other packages may have the same issue and you may wish to rebuild all packages with update.packages(checkBuilt=TRUE, ask=FALSE) to ensure this doesn't happen with other dependencies.

See Also