安装R
这一步省略,因为之前已经通过conda
安装上了
安装R包
which R
#进入R的路径,或者直接加入环境变量
##查看镜像
options()$repos
# CRAN
#"@CRAN@"
##打开文件
file.edit(file.path("~",".Rprofile"))
##“a”进入编辑状态,写入代码,Esc结束编辑,“:wq”退出
#options("repos"= c(CRAN="https://mirrors.pku.edu.cn/CRAN/","http://mirrors.aliyun.com/CRAN"))
options("repos"=c(CRAN="https://mirrors.pku.edu.cn/CRAN/","https://mirrors.tuna.tsinghua.edu.cn/CRAN/","http://mirrors.aliyun.com/CRAN","https://mirrors.ustc.edu.cn/CRAN/"))
print("已设置北大阿里云镜像")
##退出再重新进入R,查看镜像是否设置好
q()
##进入R
R
##查看镜像
options()$repos
#保证镜像源设置好,装包才能顺利
##安装BiocManager:https://www.bioconductor.org/install/
#The current release of Bioconductor is version 3.18; it works with R version 4.3.0.
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
#BiocManager安装完成
参考: