颜色空间 R 包是 Tidyverse 的一部分吗? (相互矛盾的信息)

Is the colorspace R package part of the Tidyverse? (conflicting information)

颜色空间 R 包是 Tidyverse 的一部分吗? 查看 this list of Tidyverse included packages 看来答案是 "No"。

但是,当我通过 library(tidyverse) 加载 tidyverse 时,颜色空间似乎已加载。我可以请求 ?colorspace_function() 的帮助,这些函数出现在我的 R Studio 帮助 window 中。如果我开始一个新的 R 会话,不要加载任何包,并且 运行 ?colorspace_function() 我会收到一个 "no method" 错误,如预期的那样,表明包含此功能的包未加载。

我想确保我们区分 "loaded" 和 "attached"。是的,colorspace 已加载,但未附加。

我可以复制您描述的内容,加载 tidyverse,然后成功使用 ?choose_color,但是如果我尝试 运行 choose_color(),我会收到找不到函数的错误。

查看 sessionInfo()colorspace 列为 "loaded via a namespace but not attached"。因此,可能 tidyverse 中的某些包导入了一个包,该包又导入了一个包,该包又导入了 colorspace,而 RStudio 让您可以按照链条进入帮助页面。

您甚至可以通过仅单击 "imports" 和 "depends" 链接来玩游戏,尝试从 the tidyverse CRAN page 进入色彩空间 CRAN 页面。我用 tidyverse > ggplot2 > scales > munsell > colorspace 做到了。 (或者您可以编写一个脚本来跟踪依赖关系树。)

仅仅因为在加载 tidyverse 时加载了一个包并不意味着它是 tidyverse 的一部分。例如,您可以看到 Rcpp、nlme、tools、lattice 和 grid 已加载。这些被加载是因为 tidyverse 中的包在某些方面的功能依赖于它们。此处显示的 "attached" 包可被视为 tidyverse 元包(以及其他包)的一部分。

library("tidyverse"); sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
#>  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
#>  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] forcats_0.4.0   stringr_1.4.0   dplyr_0.8.3     purrr_0.3.3    
#> [5] readr_1.3.1     tidyr_1.0.0     tibble_2.1.3    ggplot2_3.2.1  
#> [9] tidyverse_1.3.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] tidyselect_0.2.5 xfun_0.11        haven_2.2.0      lattice_0.20-38 
#>  [5] colorspace_1.4-1 vctrs_0.2.0      generics_0.0.2   htmltools_0.4.0 
#>  [9] yaml_2.2.0       rlang_0.4.2      pillar_1.4.2     withr_2.1.2     
#> [13] glue_1.3.1       DBI_1.0.0        dbplyr_1.4.2     modelr_0.1.5    
#> [17] readxl_1.3.1     lifecycle_0.1.0  munsell_0.5.0    gtable_0.3.0    
#> [21] cellranger_1.1.0 rvest_0.3.5      evaluate_0.14    knitr_1.26      
#> [25] fansi_0.4.0      highr_0.8        broom_0.5.2      Rcpp_1.0.3      
#> [29] backports_1.1.5  scales_1.1.0     jsonlite_1.6     fs_1.3.1        
#> [33] hms_0.5.2        digest_0.6.23    stringi_1.4.3    grid_3.6.1      
#> [37] cli_2.0.0        tools_3.6.1      magrittr_1.5     lazyeval_0.2.2  
#> [41] crayon_1.3.4     pkgconfig_2.0.3  zeallot_0.1.0    xml2_1.2.2      
#> [45] reprex_0.3.0     lubridate_1.7.4  assertthat_0.2.1 rmarkdown_1.17  
#> [49] httr_1.4.1       R6_2.4.1         nlme_3.1-142     compiler_3.6.1