1. 设置镜像
1 2 | options (BioC_mirror= "http://mirrors.tuna.tsinghua.edu.cn/bioconductor/" ) options ( "repos" = c (CRAN= "http://mirrors.tuna.tsinghua.edu.cn/CRAN/" )) |
2. R包分类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 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包安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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. 判断是否安装成功
前面的报错都先不要管。主要看这里
1 2 3 | for (pkg in c (Biocductor_packages,cran_packages)){ require (pkg,character.only=T) } |
没有error就是成功! 哪个报错,就回去安装哪个。
如果你没有安装xx包,却提示你xx包不存在,这也正常,是因为复杂的依赖关系,缺啥补啥。
5. 本地安装tinyarray包
1 | if (! require (tinyarray))devtools:: install_local ( "tinyarray-master.zip" ,upgrade = F) |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)