1. 设置镜像
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/") options("repos" = c(CRAN="http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
2. R包分类
cran_packages <- c("tidyr", "tibble", "dplyr", "stringr", "ggplot2", "ggpubr", "factoextra", "FactoMineR", "pheatmap", "survival", "survminer", "patchwork", "ggstatsplot", "ggplotify", "cowplot", "glmnet", "ROCR", "caret", "randomForest", "survminer", "Hmisc", "e1071", "deconstructSigs", "timeROC" ) Biocductor_packages <- c("KEGG.db", "limma", "clusterProfiler", "org.Hs.eg.db", "TCGAbiolinks", "SummarizedExperiment", "RTCGA", "RTCGA.rnaseq", "RTCGA.clinical", "DESeq2", "edgeR", "ggpubr", "rtracklayer", "genefilter", "maftools", "ComplexHeatmap", "BSgenome", "GDCRNATools", "BSgenome.Hsapiens.UCSC.hg38" )
3. R包安装
for (pkg in cran_packages){ if (! require(pkg,character.only=T) ) { install.packages(pkg,ask = F,update = F) require(pkg,character.only=T) } } if(!require("BiocManager")) install.packages("BiocManager",update = F,ask = F) options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/") getOption("BioC_mirror") getOption("repos") for (pkg in Biocductor_packages){ if (! require(pkg,character.only=T) ) { BiocManager::install(pkg,ask = F,update = F) require(pkg,character.only=T) } }
4. 判断是否安装成功
前面的报错都先不要管。主要看这里
for (pkg in c(Biocductor_packages,cran_packages)){ require(pkg,character.only=T) }
没有error就是成功! 哪个报错,就回去安装哪个。
如果你没有安装xx包,却提示你xx包不存在,这也正常,是因为复杂的依赖关系,缺啥补啥。
5. 本地安装tinyarray包
if(!require(tinyarray))devtools::install_local("tinyarray-master.zip",upgrade = F)
标签:代码,流程,TCGA,character,only,pkg,install,packages,require From: https://www.cnblogs.com/xiaogaobugao/p/16721239.html