【问题标题】:List of packages that need an update需要更新的软件包列表
【发布时间】:2014-03-18 11:15:35
【问题描述】:

如何生成需要更新的软件包列表,即包含软件包名称、当前安装的版本和存储库中可用版本的表格?

我尝试过hack packageStatus()installed.packages()update.packages(),但我无法强制这些函数产生所需的输出。

请注意,我不想真正更新这些包;我只想看看上面提到的列表。

【问题讨论】:

    标签: r updates r-package


    【解决方案1】:

    你知道old.packages()这个函数吗?

    来自help(update.packages)

     ‘old.packages’ indicates packages which have a (suitable) later 
     version on the repositories whereas ‘update.packages’ offers to
     download and install such packages.
    

    【讨论】:

    • 德克,谢谢你的回答。 OT:作为 MCMC 专家,我想问一下您是否有从 R 运行 JAGS 的经验。我正在努力解决 R2jags 和 runjags 包中的错误。但是您可能正在使用一些 Rcpp 魔法? :-)
    • @Tomas 我认为你应该为此提出一个新问题。
    • Dirk,我很乐意,但我担心“什么是运行 JAGS 的最佳方式”之类的问题会在 5 秒内关闭 :-) 更不用说像“Dirk,什么是真正的大师使用“:-)
    【解决方案2】:

    看看old.packages()。在我的系统上我有:

    R> old.packages()
                  Package         LibPath                                   Installed   Built   ReposVer    Repository                           
    bnlearn       "bnlearn"       "/home/gavin/R/build/3.0-patched/library" "3.4"       "3.0.2" "3.5"       "http://cran.rstudio.com/src/contrib"
    deldir        "deldir"        "/home/gavin/R/build/3.0-patched/library" "0.1-4"     "3.0.2" "0.1-5"     "http://cran.rstudio.com/src/contrib"
    devtools      "devtools"      "/home/gavin/R/build/3.0-patched/library" "1.3"       "3.0.2" "1.4.1"     "http://cran.rstudio.com/src/contrib"
    digest        "digest"        "/home/gavin/R/build/3.0-patched/library" "0.6.3"     "3.0.2" "0.6.4"     "http://cran.rstudio.com/src/contrib"
    extrafont     "extrafont"     "/home/gavin/R/build/3.0-patched/library" "0.15"      "3.0.2" "0.16"      "http://cran.rstudio.com/src/contrib"
    forecast      "forecast"      "/home/gavin/R/build/3.0-patched/library" "4.8"       "3.0.2" "5.1"       "http://cran.rstudio.com/src/contrib"
    foreign       "foreign"       "/home/gavin/R/build/3.0-patched/library" "0.8-57"    "3.0.2" "0.8-59"    "http://cran.rstudio.com/src/contrib"
    Matrix        "Matrix"        "/home/gavin/R/build/3.0-patched/library" "1.1-0"     "3.0.2" "1.1-2"     "http://cran.rstudio.com/src/contrib"
    matrixStats   "matrixStats"   "/home/gavin/R/build/3.0-patched/library" "0.8.12"    "3.0.2" "0.8.14"    "http://cran.rstudio.com/src/contrib"
    mgcv          "mgcv"          "/home/gavin/R/build/3.0-patched/library" "1.7-27"    "3.0.2" "1.7-28"    "http://cran.rstudio.com/src/contrib"
    mvtnorm       "mvtnorm"       "/home/gavin/R/build/3.0-patched/library" "0.9-9996"  "3.0.2" "0.9-9997"  "http://cran.rstudio.com/src/contrib"
    party         "party"         "/home/gavin/R/build/3.0-patched/library" "1.0-11"    "3.0.2" "1.0-13"    "http://cran.rstudio.com/src/contrib"
    R.methodsS3   "R.methodsS3"   "/home/gavin/R/build/3.0-patched/library" "1.5.2"     "3.0.2" "1.6.1"     "http://cran.rstudio.com/src/contrib"
    raster        "raster"        "/home/gavin/R/build/3.0-patched/library" "2.2-5"     "3.0.2" "2.2-12"    "http://cran.rstudio.com/src/contrib"
    Rcpp          "Rcpp"          "/home/gavin/R/build/3.0-patched/library" "0.10.6"    "3.0.2" "0.11.0"    "http://cran.rstudio.com/src/contrib"
    RcppArmadillo "RcppArmadillo" "/home/gavin/R/build/3.0-patched/library" "0.3.920.1" "3.0.2" "0.4.000.2" "http://cran.rstudio.com/src/contrib"
    rgl           "rgl"           "/home/gavin/R/build/3.0-patched/library" "0.93.991"  "3.0.2" "0.93.996"  "http://cran.rstudio.com/src/contrib"
    rpart         "rpart"         "/home/gavin/R/build/3.0-patched/library" "4.1-3"     "3.0.2" "4.1-5"     "http://cran.rstudio.com/src/contrib"
    scatterplot3d "scatterplot3d" "/home/gavin/R/build/3.0-patched/library" "0.3-34"    "3.0.2" "0.3-35"    "http://cran.rstudio.com/src/contrib"
    survival      "survival"      "/home/gavin/R/build/3.0-patched/library" "2.37-4"    "3.0.2" "2.37-7"    "http://cran.rstudio.com/src/contrib"
    

    针对您的具体要求:

    R> old.packages()[, c("Package","Installed","ReposVer")]
                  Package         Installed   ReposVer   
    bnlearn       "bnlearn"       "3.4"       "3.5"      
    deldir        "deldir"        "0.1-4"     "0.1-5"    
    devtools      "devtools"      "1.3"       "1.4.1"    
    digest        "digest"        "0.6.3"     "0.6.4"    
    extrafont     "extrafont"     "0.15"      "0.16"     
    forecast      "forecast"      "4.8"       "5.1"      
    foreign       "foreign"       "0.8-57"    "0.8-59"   
    Matrix        "Matrix"        "1.1-0"     "1.1-2"    
    matrixStats   "matrixStats"   "0.8.12"    "0.8.14"   
    mgcv          "mgcv"          "1.7-27"    "1.7-28"   
    mvtnorm       "mvtnorm"       "0.9-9996"  "0.9-9997" 
    party         "party"         "1.0-11"    "1.0-13"   
    R.methodsS3   "R.methodsS3"   "1.5.2"     "1.6.1"    
    raster        "raster"        "2.2-5"     "2.2-12"   
    Rcpp          "Rcpp"          "0.10.6"    "0.11.0"   
    RcppArmadillo "RcppArmadillo" "0.3.920.1" "0.4.000.2"
    rgl           "rgl"           "0.93.991"  "0.93.996" 
    rpart         "rpart"         "4.1-3"     "4.1-5"    
    scatterplot3d "scatterplot3d" "0.3-34"    "0.3-35"   
    survival      "survival"      "2.37-4"    "2.37-7" 
    

    【讨论】:

    • 领先你八秒 ;-)
    • @DirkEddelbuettel 是的,但我的答案更大:P
    • 但是来自一个明显无效的系统,因为您显示了一个过时的 Rcpp 正在使用中。
    • 谢谢!或者我可以使用更短的old.packages()[, c("Installed","ReposVer")]
    • 嗨@Dirk!这很奇怪,但我在顶部看到了 Gavin 的答案,直到现在才注意到你的答案,即使他的分数较低 :-) 也要归功于你 :)
    猜你喜欢
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    • 1970-01-01
    • 2020-11-29
    • 2014-04-26
    • 2014-06-09
    • 2011-04-12
    • 2021-04-24
    相关资源
    最近更新 更多