在使用R語言完成數(shù)據(jù)分析的過程中,很多時(shí)候,因?yàn)轫?xiàng)目實(shí)際需要,我們應(yīng)該指定某些庫文件的安裝包的版本,這個(gè)時(shí)候,我們可以基于devtools
包中的函數(shù)install_version
來完成。
這里,我們以安裝庫文件ggplot2
的安裝包的版本號(hào)為3.3.6為例來說明,即
devtools::install_version("ggplot2",version = "3.3.6",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/")
說明如下:
- version
版本號(hào)
- repos
倉庫地址,這里將其指定為清華大學(xué)開源鏡像站的地址文章來源:http://www.zghlxwxcb.cn/news/detail-832985.html
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)
參考文獻(xiàn)文章來源地址http://www.zghlxwxcb.cn/news/detail-832985.html
- Installing older versions of packages
- R 3.2.3 devtools::install_version() fails (.zip file not found)
到了這里,關(guān)于How to install a specific version of a package in R的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!