34

I have installed ggplot and ggplot2 and their dependencies, but I cannot use the function ggplot; whenever I try to use it I get

Error in ggplot ... could not find function "ggplot"

Timbus Calin
  • 13,809
  • 5
  • 41
  • 59
optform
  • 1,017
  • 3
  • 10
  • 6
  • 1
    I don't know where you found a copy of `ggplot`, since it's no longer available on CRAN. `ggplot2` has completely replaced it. – Andrie Aug 10 '11 at 22:17
  • 1
    I would reopen. I think gsk's answer is probably the right one and its definitely a FAQ even if it's not in the FAQ. – IRTFM Aug 10 '11 at 23:30
  • 1
    @DWin: yes it is, see FAQ 7.30 ... – Ben Bolker Aug 11 '11 at 01:58
  • @DWin : it is the right answer, so no more answers needed. These kind of questions best disappear into oblivion. – Joris Meys Aug 11 '11 at 12:54
  • @Joris Meys: I guess you changed your mind on that point? (Since you posted a basically an identical question later.) – IRTFM Aug 11 '11 at 15:13
  • @DWin : yeah... Actually, I first thought of editing this one to make it a whole lot more general (basically cutting out the ggplot and replacing it with dots), but then again, gsk3 would have to rewrite his answer. So that's why I made that almost identical question. – Joris Meys Aug 11 '11 at 15:16

1 Answers1

57

Try:

library(ggplot2)

Even after installing a package, you have to load a package each time you load R.

This question is answered comprehensively in the r-faq:

Error: could not find function ... in R

Community
  • 1
  • 1
Ari B. Friedman
  • 71,271
  • 35
  • 175
  • 235