2019-06-27 R包安装大全
2019-06-27 本文已影响0人
阿乜太帅
以安装R包DEseq2为例
1. 常规
install.packages("DEseq2")
install.packages("DEseq2", dependencies=TRUE, repos="http://cran.rstudio.com/")
install.packages("DEseq2", dependencies=TRUE, repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
2. source bioconductor官网
source("http://bioconductor.org/biocLite.R")
biocLite("DESeq2")
3. 3.5版本以上的R的最新安装办法
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("DESeq2")
4. 原网址调取
rpackage <- "https://www.bioconductor.org/packages/release/bioc/src/contrib/DESeq2_1.22.2.tar.gz"
install.packages(rpackage, repos=NULL, type="source")
5. github 调取安装
install.packages("devtools")
library(devtools)
devtools::install_github("DESeq2")
6. 批量安装R包,可参考生信菜鸟团
(http://www.bio-info-trainee.com/5764.html)
7. 安装本地R包
install.packages("~/magick_2.0.tar.gz", repos = NULL)
8. 安装指定版本R包
require(devtools)
install_version("ggplot", version = "3.2.1", repos = "http://cran.us.r-project.org")
更改镜像
options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))) #清华
options(repos=structure(c(CRAN="http://mirrors.opencas.cn/cran/")))
options(BioC_mirror="http://mirrors.opencas.cn/cran/")
options(BioC_mirror="http://mirrors.ustc.edu.cn/bioc/")
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
普通联网问题
options(download.file.method = 'libcurl')
修改R包安装位置
#查看当前有什么路径
.libPaths()
# 然后加入新路径
myPaths <- .libPaths()
# 新路径是:~/R/3.5.0/library
new <- c('~/R/3.5.0/library')
myPaths <- c(myPaths, new)
.libPaths(myPaths)
查看已经安装的R包位置
find.package("DEseq")
查看已经安装的R包版本
packageVersion("DEseq")
卸载已经安装的R包版本
remove.packages("DEseq")
调用指定lib下的R包
library("DEseq",lib.loc="/home/aaa/R/x86_64-pc-linux-gnu-library/3.4")
显示英文报错信息
Sys.setenv(LANGUAGE = "en")
禁止chr转成factor
options(stringsAsFactors = FALSE)