Cannot load package in R

Bangyou picture Bangyou · Nov 5, 2015 · Viewed 8.3k times · Source

Since yesterday, I cannot load some common used packages, e.g. reshape2 and stringr through library command.

Step to reproduce my problem:

1) Start a new session in Rstudio server (Version 0.99.467). I also kill the active-sessions in Rstudio server.

2) Run these codes

library(ggplot2)
library(stringr)

3) Get an error message:

Error in unloadNamespace(package) : namespace ‘stringr’ is imported by ‘reshape2’ so cannot be unloaded Show Traceback

Rerun with Debug

Error in library(stringr) : “stringr” version 0.6.2 cannot be unloaded.

But I don't get error if stringr is loaded before ggplot2. How should I fix this problem. Thanks for any suggestions.

I may have to update R to 3.2

My R session info:

R version 3.1.3 (2015-03-09)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8    LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] ggplot2_1.0.0

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4     grid_3.1.3       gtable_0.1.2     MASS_7.3-39      munsell_0.4.2    plyr_1.8.1      
 [8] proto_0.3-10     Rcpp_0.11.2      reshape2_1.4     scales_0.2.4     stringr_0.6.2    tools_3.1.3    

Answer

Bangyou picture Bangyou · Nov 9, 2015

I resolved my problem through updating R and all R packages.

I guess the problem is caused by old version of stringr or reshape2 as I install the same packages in different places (system folder or personal library). R tried to load a old version of package.