R包clusterProfiler如何安裝成功(新手必看!)
前言
里面有些坑,寫篇博客介紹一下。
R包clusterProfiler
是生物信息分析匯總,基因富集分析可視化經常用到的R包,但是安裝時,新手經常會遇到一些問題,這里簡單總結一下。
看重點:正確的安裝方式
官網:https://bioconductor.org/packages/release/bioc/html/clusterProfiler.html
在R中運行下面命令,安裝即可:
if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("clusterProfiler")
1. 在CRAN中用install.packages()安裝
install.packages("clusterProfile")
安裝報錯:
> install.packages("clusterProfile") (因為‘lib'沒有被指定) Warning in install.packages : package ‘clusterProfile' is not available for this version of R A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages >
報錯原因,因為clusterProfile
不在CRAN中,所以不能通過install.packages
進行安裝。
2. 安裝bioconductor報錯
有時候,知道在bioconductor中,于是還是安裝:
install.packages("bioconductor")
報錯如下:
> install.packages("bioconductor") (因為‘lib'沒有被指定) Warning in install.packages : package ‘bioconductor' is not available for this version of R A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
3. 正確而順利的安裝方法
3.1 安裝最新版R
目前是4.2.1,因為R4.2之前的clusterProfiler有bug,kegg聯(lián)網會報錯,新版本沒有問題了。
3.2 安裝Rtools4.2
這是單機軟件,地址:https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html
3.3 配置鏡像
在Rstudio中,將下載鏡像變?yōu)橹袊?,下載速度會快很多。
3.4 正式安裝
在Rstudio中運行安裝代碼:
if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("clusterProfiler")
這中間會安裝許多依賴包,如果有某個包安裝報錯了,就單獨安裝那個包,安裝成功后,在運行安裝clusterProfiler的代碼。
4. 配置建議
- R最新版的R4.2.1
- 安裝Rtools(windows系統(tǒng)建議)
- 安裝路徑不要有中文路徑
- 如果電腦用戶名是中文的,建議新建一個英文用戶名,然后登錄安裝
- 配置鏡像,提升安裝速度
總結
到此這篇關于R包clusterProfiler如何安裝成功的文章就介紹到這了,更多相關R包clusterProfiler安裝成功內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!