Hi All,
I am totally new to ggplot, and am using it with R Studio.
I am able to create basic graphs, but when i want to add titles and I follow the hints on sites like R Cookbook, I get error messages.
eg. I have created a line graph with two lines. The first line is from a column of data "prop_vacc_sick", and the second line is from a column of data "prop_unvacc_sick".
All is fine, but when I want to add a title and use any of the prescribed methods, eg + labs(title="xxx") or + ggtitle(" xxx"), i get a message: error: could not find function "ggtitle"
HERES THE CODE:
ggplot(mcf_clin.master) + geom_line(aes(x = days.pre..post.challenge, y=prop_vacc_sick)) +
+ geom_line(data = mcf_clin.master, aes(x = days.pre..post.challenge, y=prop_unvacc_sick),
+ colour = 'red', size = 1) + labs(title="Trial 1", x="Days pre- / post-challenge", y="Proportion sick")
> + ggtitle("Average bill for 2 people")
Error: could not find function "ggtitle"
Similarly if I try to create a legend, I get error messages such as ....
Error: could not find function "theme"
Error: could not find function "guides"
I am wondering if ggplot2 has loaded properly as when I installed it there were error messages...
Warning in install.packages :
cannot open: HTTP status was '410 Gone'
Warning in install.packages :
unable to access index for repository
http://cran.ru.ac.za/bin/macosx/leopard/contrib/2.12
Warning in install.packages :
package ‘ggplot2’ is not available
Loading required package: reshape
Loading required package: plyr
Attaching package: 'reshape'
The following object(s) are masked from 'package:plyr':
rename, round_any
Loading required package: grid
Loading required package: proto
Warning messages:
1: package 'ggplot2' was built under R version 2.12.1
2: package 'reshape' was built under R version 2.12.1
3: package 'plyr' was built under R version 2.12.2
4: package 'proto' was built under R version 2.12.2
ANY HELP MOST APPRECIATED,
FELIX