Rlang: Difference between revisions

From Leo's Notes
This page was last edited on 5 February 2020, at 16:58.
Created page with " == Tasks == === Packages === To list all installed packages: {{highlight|lang=terminal|code= > installed.packages()[, c("Package", "LibPath")] }} For non-root users, you ma..."
 
mNo edit summary
Line 21: Line 21:
To update all packages:
To update all packages:
{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
> update.packages(ask = FALSE)
> update.packages()
# or
> install.packages( update = TRUE, ask = TRUE )
}}
}}


Line 32: Line 34:
> BiocManager::install("BiocParallel")
> BiocManager::install("BiocParallel")
}}
}}
To update packages in Bioconductor, just run install again. If no package is specified, all previously installed packages will be updated.
{{highlight|lang=terminal|code=
## Updates all packages
> BiocManager::install()
}}
Multiple packages can be passed:
{{highlight|lang=terminal|code=
> BiocManager::install(c("GenomicRanges", "edgeR"))
}}
Installation from source can be specified with {{code|1=type="source"}}:
{{highlight|lang=terminal|code=
## install a package from source:
> BiocManager::install("IRanges", type="source")
}}
To update Bioconductor to a different revision, run:
{{highlight|lang=terminal|code=
> 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:
{{highlight|lang=terminal|code=
> BiocManager::version
}}


If you ever get an error like the following:
If you ever get an error like the following:
Line 65: Line 99:
[1] BiocManager_1.30.4 compiler_3.6.0    tools_3.6.0
[1] BiocManager_1.30.4 compiler_3.6.0    tools_3.6.0
}}
}}
Load a package using the {{code|library()}} function for it to show up as 'attached'.

Revision as of 16:58, 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'.