R Studio not detaching packages when exiting program

I've noticed recently that sometimes RStudio doesn't seem to detach all non base packages when closing the Console. Specifically, when I start a new, fresh session (not loading an .Rdata file or restoring a worskspace), some packages seem to be attaching automatically (or at least loaded via namespace). Specifically, I've been doing some Bayesian analysis with the bayesforecast package. It seems like this package is being loaded automatically. In fact, it seems that many, many packages are loaded. They are all packages I have used recently but did not load in the session.

I'm running R Studio version 2021.09.0 Build 351.

I running R versions 4.1.1. I noticed this because when I start new session, the following messages appeared:

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Registered S3 methods overwritten by 'bayesforecast':
  method      from    
  autoplot.ts forecast
  forecast.ts forecast
  fortify.ts  forecast
  print.garch tseries

Running sessionInfo() from R Studio:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

loaded via a namespace (and not attached):
 [1] bayesforecast_1.0.1  Rcpp_1.0.7          
 [3] lubridate_1.8.0      mvtnorm_1.1-2       
 [5] lattice_0.20-45      listenv_0.8.0       
 [7] prettyunits_1.1.1    ps_1.6.0            
 [9] zoo_1.8-9            assertthat_0.2.1    
[11] digest_0.6.28        lmtest_0.9-38       
[13] utf8_1.2.2           V8_3.6.0            
[15] parallelly_1.28.1    R6_2.5.1            
[17] plyr_1.8.6           ggridges_0.5.3      
[19] stats4_4.1.1         coda_0.19-4         
[21] ggplot2_3.3.5        pillar_1.6.3        
[23] rlang_0.4.11         curl_4.3.2          
[25] fracdiff_1.5-1       callr_3.7.0         
[27] TTR_0.24.2           Matrix_1.3-4        
[29] stringr_1.4.0        loo_2.4.1           
[31] munsell_0.5.0        compiler_4.1.1      
[33] rstan_2.21.2         pkgconfig_2.0.3     
[35] forecast_8.15        pkgbuild_1.2.0      
[37] urca_1.3-0           rstantools_2.1.1    
[39] globals_0.14.0       nnet_7.3-16         
[41] tidyselect_1.1.1     gridExtra_2.3       
[43] tibble_3.1.5         matrixStats_0.61.0  
[45] quadprog_1.5-8       codetools_0.2-18    
[47] fansi_0.5.0          future_1.22.1       
[49] crayon_1.4.1         dplyr_1.0.7         
[51] withr_2.4.2          MASS_7.3-54         
[53] grid_4.1.1           nlme_3.1-153        
[55] jsonlite_1.7.2       gtable_0.3.0        
[57] lifecycle_1.0.1      DBI_1.1.1           
[59] magrittr_2.0.1       StanHeaders_2.21.0-7
[61] scales_1.1.1         RcppParallel_5.1.4  
[63] quantmod_0.4.18      stringi_1.7.5       
[65] future.apply_1.8.1   cli_3.0.1           
[67] pbapply_1.5-0        tseries_0.10-49     
[69] timeDate_3043.102    ellipsis_0.3.2      
[71] xts_0.12.1           generics_0.1.0      
[73] vctrs_0.3.8          tools_4.1.1         
[75] prophet_1.0          glue_1.4.2          
[77] purrr_0.3.4          processx_3.5.2      
[79] parallel_4.1.1       inline_0.3.19       
[81] colorspace_2.0-2     bridgesampling_1.1-2
[83] bayesplot_1.8.1      Brobdingnag_1.2-6  

When I run the same thing from R 4.1.1 directly, I get:

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.1

So this does seem to be something related to RStudio.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.