R包描述中的imports字段如何表现(例如)

时间:2017-11-14 10:48:47

标签: r packages dependency-management

我正在努力让我的R包以我期望的方式安装依赖项。安装我的软件包后,我希望它安装描述文件中指定的magrittr依赖项版本,但它不起作用。见下面的最小例子:

remove.packages("magrittr")
install.packages("devtools")
library(devtools)
devtools::install_github('maxwell8888/descriptiontest', dependencies = TRUE, force = TRUE)

packageVersion("magrittr") # returns '1.0.0'

# install package with Imports: magrittr (>= 1.5) in the DESCRIPTION
devtools::install_github('maxwell8888/descriptiontest')

packageVersion("magrittr") # still returns '1.0.0'

# confirm that 1.5 is availble
install.packages("magrittr")
packageVersion("magrittr") # now returns '1.5'


devtools::session_info()
Session info -------------------------------------------------------------------------
setting  value                       
 version  R version 3.4.1 (2017-06-30)
 system   i386, mingw32               
 ui       RStudio (1.0.153)           
 language (EN)                        
 collate  English_United Kingdom.1252 
 tz       Europe/London               
 date     2017-11-14                  

Packages -----------------------------------------------------------------------------
 package   * version date       source        
 base      * 3.4.1   2017-06-30 local         
 compiler    3.4.1   2017-06-30 local         
 curl        2.8.1   2017-07-21 CRAN (R 3.4.1)
 datasets  * 3.4.1   2017-06-30 local         
 devtools  * 1.13.4  2017-11-09 CRAN (R 3.4.2)
 digest      0.6.12  2017-01-27 CRAN (R 3.4.1)
 git2r       0.19.0  2017-07-19 CRAN (R 3.4.1)
 graphics  * 3.4.1   2017-06-30 local         
 grDevices * 3.4.1   2017-06-30 local         
 httr        1.2.1   2016-07-03 CRAN (R 3.4.1)
 knitr       1.17    2017-08-10 CRAN (R 3.4.2)
 memoise     1.1.0   2017-04-21 CRAN (R 3.4.1)
 methods   * 3.4.1   2017-06-30 local         
 R6          2.2.2   2017-06-17 CRAN (R 3.4.1)
 stats     * 3.4.1   2017-06-30 local         
 tools       3.4.1   2017-06-30 local         
 utils     * 3.4.1   2017-06-30 local         
 withr       2.0.0   2017-07-28 CRAN (R 3.4.1)

1 个答案:

答案 0 :(得分:0)

您可以针对您要查找的版本尝试此操作

packageurl <-
"https://cran.r-project.org/src/contrib/Archive/magrittr/magrittr_1.0.0.tar.gz"

install.packages(packageurl, repos=NULL, type="source")