BillPetti
BillPetti

Reputation: 541

Stop packages from loading on startup in RStudio

When opening RStudio I have a few packages that are loading. I have not set up my .rprofile to load packages on start up.

Here's the content of my current profile:

# startup options for R

# turn off scientific notation by default
# hard code the US repo for CRAN

.First <- function() {
    options(scipen = 999)
}

local({
  r = getOption("repos")             
  r["CRAN"] = "https://cran.rstudio.com/"
  options(repos = r)
})

For regular start up and most projects, these packages are loading:

Loading required package: RMySQL
Loading required package: DBI  

Although, for another project I see this:

Loading required package: RMySQL
Loading required package: DBI
Loading required package: clValid
Loading required package: cluster

At startup, here is what my session looks like:

R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] RMySQL_0.10.13 DBI_0.7       

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16      magrittr_1.5      maps_3.2.0        munsell_0.4.3    
 [5] colorspace_1.3-2  geosphere_1.5-5   lattice_0.20-35   rjson_0.2.15     
 [9] jpeg_0.1-8        rlang_0.2.0       stringr_1.3.0     plyr_1.8.4       
[13] tools_3.4.1       grid_3.4.1        gtable_0.2.0      png_0.1-7        
[17] lazyeval_0.2.0    tibble_1.4.2      ggmap_2.6.1       mapproj_1.2-5    
[21] reshape2_1.4.2    ggplot2_2.2.1     ggrepel_0.6.5     sp_1.2-5         
[25] stringi_1.1.6     compiler_3.4.1    pillar_1.1.0.9000 RgoogleMaps_1.4.1
[29] scales_0.5.0      proto_1.0.0  

Upvotes: 1

Views: 688

Answers (1)

BillPetti
BillPetti

Reputation: 541

Apparently I had prior established database connection objects that were saved in my .Rdata file and upon loading of a project these connections were requiring the packages to be loaded. After removing the connections the packages no longer load on start up.

Upvotes: 2

Related Questions