shreyasm
shreyasm

Reputation: 31

Error when trying to load library(ggplot2) in R

I'm having trouble loading the ggplot2 library in R. Below is the code that I type in. Anyone have any ideas on how to make this work?

> library(ggplot2)
Error in get(x, envir = this, inherits = inh) : 
  unused argument(s) (envir = this, inherits = inh)

Error : unable to load R code in package 'ggplot2'

Error: package/namespace load failed for 'ggplot2'

Edit 1: More Info

> sessionInfo()
 R version 2.13.0 (2011-04-13)
 Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

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

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

 other attached packages:
 [1] quantmod_0.3-15 TTR_0.20-2      xts_0.8-0       zoo_1.6-5   Defaults_1.1-1
 [6] reshape2_1.1    proto_0.3-9.2   reshape_0.8.4   plyr_1.5.2

 loaded via a namespace (and not attached):
 [1] lattice_0.19-26 stringr_0.4     tools_2.13.0

Edit 2:

The version of ggplot2 that I'm trying to use is 0.8.9. When I call the traceback function I get the following result:

> traceback()
  2: stop(gettextf("package/namespace load failed for '%s'", package),
       call. = FALSE, domain = NA)
  1: library(ggplot2)

Upvotes: 3

Views: 7609

Answers (1)

IRTFM
IRTFM

Reputation: 263331

Quit R. Go into your /Library/Frameworks/R.framework/Versions/2.13/Resources/library/ directory and trash the entire folder. If you have any other libraries make sure they don't have any copies, either. Restart R and reinstall and make sure you install all dependencies. There is a check mark option in the GUI Package Installer or you can use (at the command line: install.packages("ggplot2", dependencies=c("Depends", "Imports", "Suggests") ).

Further thought: Obscure errors in the MacOS can sometimes be resolved by repairing disk permissions. The Disk Utility.app program is the way I usually do it. Some people run it on a regular basis although I only do so when a problem arises that seems to be a file access issue.

Upvotes: 4

Related Questions