R语言中安装包常见的3种来源
1、从cran安装(https://cran.r-project.org/)
示例:
> install.packages("ggplot2") ## 安装 trying URL 'https://mirrors.bfsu.edu.cn/CRAN/bin/windows/contrib/4.1/ggplot2_3.3.5.zip' Content type 'application/zip' length 4129517 bytes (3.9 MB) downloaded 3.9 MB package ‘ggplot2’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\75377\AppData\Local\Temp\RtmpIz7wez\downloaded_packages
> library(ggplot2) ## 调用 Warning message: 程辑包‘ggplot2’是用R版本4.1.3 来建造的
2、从Bioconductor安装(https://bioconductor.org/)
示例:
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("ggtree") ## 安装 a library(ggtree) ## 调用
3、从github安装 (https://github.com/)
示例:(如果R不是在安装在默认的c盘, 可能会有一些文件copy权限的报错,但是最终包能调用。最好R安装的时候选择默认的c盘吧)
library(devtools) install_github("thackl/thacklr") install_github("thackl/gggenomes") ## 安装 library(thacklr) library(gggenomes) ## 调用
参考:https://mp.weixin.qq.com/s?__biz=MzI1NjUwMjQxMQ==&mid=2247508004&idx=1&sn=bc2ad40af0f06518cab44c95b50f7de0&chksm=ea275fc0dd50d6d6e62e56c3f78ff4718ad4c6111902329b68cdfc200067e2f18c2c51f8857f&mpshare=1&scene=23&srcid=0429Mj2JbsSzCCIezivnMv0i&sharer_sharetime=1651298928279&sharer_shareid=50b75c6a886e09824b582fb782a7678b#rd