daily R_LANG Commands

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.

1. related to environment variables
Sys.getenv()
Sys.setenv(BINPREF = “”)

## try http:// if https:// URLs are not supported

2. Change directory: setwd(‘E:/’) or setwd(“E:/”)
caveat: use ‘/’ not ‘\’ in windows.
*: list items in the current directory: dir()

3. bioconductor:
options(BioC_mirror=”https://mirrors.ustc.edu.cn/bioc/”) #换成国内的源,用于加速
if (!requireNamespace(“BiocManager”, quietly = TRUE))
install.packages(“BiocManager”)
BiocManager::install(“ChIPseeker”)

4. update, remove packages
update.packages()
remove.packages()

5. upgrade R
library(installr)
updateR()

6. rstudio换源加速

7. BiocManager换源
源列表:https://www.bioconductor.org/about/mirrors/
options(BioC_mirror=”http://mirrors.ustc.edu.cn/bioc/”)

8. local installation of r package:
install.packages(“BiocInstaller_1.20.1.tar.gz”, repos = NULL)
“R -e “install.packages(‘shiny’, repos=’https://cran.rstudio.com/’)””
R CMD INSTALL package.tar.gz