Rlang: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 101: | Line 101: | ||
Load a package using the {{code|library()}} function for it to show up as 'attached'. | Load a package using the {{code|library()}} function for it to show up as 'attached'. | ||
== See Also == | |||
* https://astrobiomike.github.io/R/installing_packages | |||
* https://rdrr.io/github/Bioconductor/BiocManager/man/install.html | |||
Revision as of 17:01, 5 February 2020
Tasks
Packages
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:
.libPaths('~/.R/packages')
To remove a package:
> remove.packages("BiocManager")
Removing package from ‘/usr/lib64/R/library’
To update all packages:
> update.packages()
# or
> install.packages( update = TRUE, ask = TRUE )
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.
Other
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
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=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'.