Create local R library Repo

As Python packages, we suggest that users maintain an R library repo in the home directory.

Install R libraries using 'install.packages() function

Users can simply use the following command to install an R library if it is available on CRAN, the package repository features 17000+ packages:

>install.packages("package_name")

Install R Libraries from Github

Some R packages are maintained by the authors on GitHub, and they are not available on CRAN. in this case, you would need the install_github() function which is available in "devtool" library. If you do not have "devtools" in your home R library repo, use the following command to install it.
>install.packages("devtools")

And then use the following command
>library(devtools)
>install_github("author_name/package_name")

Install R libraries from Bioconductor

Some R libraries are only available via Bioconductor, an open-source tool for analysis and comprehension of high-throughput genomic data. The installation instruction and detailed documents can be found at https://www.bioconductor.org/.

For example, to install scran, using the following commands to install "BiocManager" (if not installed yet) and the library "scran"
>if (!requireNamespace("BiocManager", quietly = TRUE)) 
install.packages("BiocManager")
>BiocManager::install("scran"

if (requireNamespace("BiocManager", quietly = TRUE))

install.packages("BiocManager")

BiocManager::install("scran")

R environments in anaconda

First load the anaconda3 module like this:

module load anaconda3

You can create an R environment in conda via this command where 'my ve name' is the name you choose for the env:
conda create -n <my_ve_name> r-essentials r-base

After downloading all of the essential R packages you can activate the enviroment via:
conda activate <my_ve_name> 

The official docs for R from anaconda: https://docs.anaconda.com/anaconda/user-guide/tasks/using-r-language/

-- Zhiwei- 4/2/21
Topic revision: r3 - 02 Apr 2021, AdminUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback