在使用R语言完成数据分析的过程中,很多时候,因为项目实际需要,我们应该指定某些库文件的安装包的版本,这个时候,我们可以基于devtools
包中的函数install_version
来完成。
这里,我们以安装库文件ggplot2
的安装包的版本号为3.3.6为例来说明,即
devtools::install_version("ggplot2",version = "3.3.6",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/")
说明如下:
版本号
仓库地址,这里将其指定为清华大学开源镜像站的地址
devtools::install_version("ggplot2",version = "3.3.6",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/")
Downloading package from url: https://mirrors.tuna.tsinghua.edu.cn/CRAN//src/contrib/Archive/ggplot2/ggplot2_3.3.6.tar.gz
Installing package into ‘/home/lwk/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ggplot2)
参考文献