美文网首页
加载包:

加载包:

作者: 哇珍 | 来源:发表于2021-03-21 20:35 被阅读0次

当包不能安装时

第一类情况

第一种方法

install.packages("remotes")
remotes::install_github("包名'')

第二种方法

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("包名")

第三种方法

library(utils)
rforge <-  "http://r-forge.r-project.org"
install.packages("包名", repos=rforge, dependencies=TRUE)

第四种方法(我比较常用)

install.packages("包名",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN")

第五种方法(成功率99%)

install.packages('package-name',repos='http://cran.us.r-project.org')

第二类情况

当显示R版本太低

Warning in install.packages :package ‘caTools’ is not available (for R version 3.4.4)

Check that getOption("repos") refers to a CRAN repository that contains the needed package versions:

packageurl <- https://cran.r project.org/src/contrib/Archive/caTools/caTools_1.14.tar.gz  
install.packages(packageurl, repos=NULL, type="source")

下载了包之后不能运行

library(DESeq2)

Loading required package: SummarizedExperiment
Loading required package: DelayedArray
Loading required package: matrixStats
Error in value[3L] :
Package ‘matrixStats’ version 0.57.0 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘matrixStats’ is imported by ‘coin’ so cannot be unloaded

处理:

install.packages("matrixStats",dependencies = TRUE, repos = "http://cran.us.r-project.org")

相关文章

网友评论

      本文标题:加载包:

      本文链接:https://www.haomeiwen.com/subject/ulhocltx.html