Search code examples
rrstudioggally

Registered S3 method overwritten by 'GGally': method from +.gg - RStudio loading package without running code?


Very peculiar behaviour in GGally - I filed an issue here. My question to you folks is, do you think that is a bug in RStudio or in GGally. How does this even happen?

In a completely new R Studio project, when opening a script that contains a line of code with a GGally function (In my case, opening a script just containing a line GGally::ggcorr(p), nothing more), there will pop a message into the console.

Registered S3 method overwritten by 'GGally': method from
+.gg ggplot2

This happens without even running a line of code!!

Somehow, GGally seems to be loaded into the namespace, but only in RStudio, not when running a reprex. Further - this only happens when I am calling a function with GGally::..., and does not happen when for example

library(GGally)
ggcorr(p)

And this message comes whenever restarting R within RStudio with a saved script containing GGally::...

SessionInfo (without having run actual code!)

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   

SessionInfo with reprex package:

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

Created on 2021-05-02 by the reprex package (v2.0.0)


Solution

  • This is caused by RStudio code diagnostics - they can be modified / turned on/off under

    Tools > Global options > Code > Diagnostics