如何解决注册的 S3 方法被 'GGally' 覆盖:来自 +.gg 的方法 - RStudio 加载包而不运行代码?
Ggally 中非常奇特的行为 - I filed an issue here。我对你们的问题是,你们认为这是 RStudio 还是 Ggally 中的错误。这是怎么发生的?
在一个全新的 R Studio 项目中,当打开一个包含一行带有 Ggally 函数的代码的脚本时(在我的例子中,打开一个只包含一行 Ggally::ggcorr(p)
的脚本,仅此而已),会弹出一条消息进入控制台。
已注册的 S3 方法被 'Ggally' 覆盖:
方法来自
+.gg ggplot2
这甚至不需要运行一行代码!
不知何故,Ggally 似乎被加载到命名空间中,但仅在 RStudio 中,而不是在运行 reprex 时。此外 - 这仅在我使用 Ggally::...
调用函数时发生,并且不会发生,例如
library(Ggally)
ggcorr(p)
每当使用包含 Ggally::...
SessionInfo(无需运行实际代码!)
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 Ggally_2.1.1 magrittr_2.0.1 tidyselect_1.1.1
[5] munsell_0.5.0 colorspace_2.0-0 R6_2.5.0 rlang_0.4.11
[9] fansi_0.4.2 plyr_1.8.6 dplyr_1.0.5 tools_4.0.5
[13] grid_4.0.5 gtable_0.3.0 utf8_1.2.1 DBI_1.1.1
[17] ellipsis_0.3.2 yaml_2.2.1 assertthat_0.2.1 tibble_3.1.1
[21] lifecycle_1.0.0 Crayon_1.4.1 purrr_0.3.4 RColorBrewer_1.1-2
[25] ggplot2_3.3.3 vctrs_0.3.8 glue_1.4.2 compiler_4.0.5
[29] pillar_1.6.0 generics_0.1.0 scales_1.1.1 reshape_0.8.8
[33] pkgconfig_2.0.3
带有 reprex 包的会话信息:
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
#>
#> attached base packages:
#> [1] stats graphics Grdevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] knitr_1.33 magrittr_2.0.1 rlang_0.4.11 fansi_0.4.2
#> [5] stringr_1.4.0 styler_1.4.1 highr_0.9 tools_4.0.5
#> [9] xfun_0.22 utf8_1.2.1 withr_2.4.2 htmltools_0.5.1.1
#> [13] ellipsis_0.3.2 yaml_2.2.1 digest_0.6.27 tibble_3.1.1
#> [17] lifecycle_1.0.0 Crayon_1.4.1 purrr_0.3.4 vctrs_0.3.8
#> [21] fs_1.5.0 glue_1.4.2 evaluate_0.14 rmarkdown_2.7
#> [25] reprex_2.0.0 stringi_1.5.3 compiler_4.0.5 pillar_1.6.0
#> [29] backports_1.2.1 pkgconfig_2.0.3
由 reprex package (v2.0.0) 于 2021 年 5 月 2 日创建
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。