使用库('tidyverse')而不是子包有什么好处?

时间:2018-05-09 16:23:44

标签: r shiny tidyverse

如果我们调用R包,我想知道对大型shinytidyverse)应用程序会产生什么影响。我们通常会分别调用dplyrtidyr等。任何提示都是受欢迎的!

提前致谢!

1 个答案:

答案 0 :(得分:19)

  

更新:截至2019年1月29日,递归依赖计数现在高达92。

tidyverse包目前有87个依赖项。

  1. 加载所有这些内容会略微增加您的应用程序的启动时间,
  2. 如果您正在使用packrat,则必须在本地库中保存87个软件包的副本。如果您未使用packrat可能会在6个月内更新并破坏您的闪亮应用。
  3. 如果您一直关注性能并长期维护此应用程序,我建议尽量减少依赖关系并仅加载您实际使用的软件包。

    sort(tools::package_dependencies(package="tidyverse", recursive=TRUE)$tidyverse)
    
    # [1]  "askpass"      "assertthat"   "backports"   
    # [4]  "base64enc"    "BH"           "bindr"       
    # [7]  "bindrcpp"     "broom"        "callr"       
    # [10] "cellranger"   "cli"          "clipr"       
    # [13] "colorspace"   "crayon"       "curl"        
    # [16] "DBI"          "dbplyr"       "digest"      
    # [19] "dplyr"        "evaluate"     "fansi"       
    # [22] "forcats"      "fs"           "generics"    
    # [25] "ggplot2"      "glue"         "graphics"    
    # [28] "grDevices"    "grid"         "gtable"      
    # [31] "haven"        "highr"        "hms"         
    # [34] "htmltools"    "httr"         "jsonlite"    
    # [37] "knitr"        "labeling"     "lattice"     
    # [40] "lazyeval"     "lubridate"    "magrittr"    
    # [43] "markdown"     "MASS"         "Matrix"      
    # [46] "methods"      "mgcv"         "mime"        
    # [49] "modelr"       "munsell"      "nlme"        
    # [52] "openssl"      "pillar"       "pkgconfig"   
    # [55] "plogr"        "plyr"         "prettyunits" 
    # [58] "processx"     "progress"     "ps"          
    # [61] "purrr"        "R6"           "RColorBrewer"
    # [64] "Rcpp"         "readr"        "readxl"      
    # [67] "rematch"      "reprex"       "reshape2"    
    # [70] "rlang"        "rmarkdown"    "rstudioapi"  
    # [73] "rvest"        "scales"       "selectr"     
    # [76] "stats"        "stringi"      "stringr"     
    # [79] "sys"          "tibble"       "tidyr"       
    # [82] "tidyselect"   "tinytex"      "tools"       
    # [85] "utf8"         "utils"        "viridisLite" 
    # [88] "whisker"      "withr"        "xfun"        
    # [91] "xml2"         "yaml"