1 普通安裝(從CRAN安裝)

install。packages(“包名”)

2 從Bioconductor安裝(主要是一些生物學包)

# 先安裝BiocManager包

install。packages(“BiocManager”)

# 再呼叫BiocManager包裡的i

nstall函式

安裝

BiocManager::install(“包名”)

3 從GitHub上安裝

3。1 方式一: devtools

# 先安裝devtools包

install。packages(“devtools”)

# 再呼叫devtools包裡的install_github函式安裝

devtools::install_github(“github使用者名稱/包名”)

3。2 方式二: remotes

# 先安裝remotes包

install。packages(“remotes”)

# 再呼叫remotes包裡的install_github函式安裝

remotes::install_gitlab(“github使用者名稱/包名”)

4 下載到本地安裝

4。1 CRAN

https://

cran。r-project。org/web/

packages/available_packages_by_name。html

中找到並下載R包到本地

install。packages(“路徑+檔名稱”)

install。packages(“C://Users/82414/Downloads/ggplot2_3。3。5。tar。gz”)

注意

:還需要按照CRAN上的提示安裝此包的依賴包

4。2 GitHub

https://

github。com/

上找到並下載

解壓並在R中開啟此路徑(setwd(“路徑名”))

安裝

devtools::install_local()

5 常見問題總結

5。1 package ‘name’ is not available for this version of R

Warning in install。packages : package ‘Mfuzz’ is not available for this version of R

從CRAN上檢查此包需要的R版本,如果大於您的R版本,需要升級R

通常情況下,一般是需要用到本文中第2或3種方法安裝

6 附錄

CRAN有哪些包:

Bioconductor有哪些包: