[R] Trying to change a qplot() to a ggplot()+
John McKown
john.archie.mckown at gmail.com
Wed Jul 23 15:47:55 CEST 2014
I'm trying to change a qplot to a ggplot. The reason is because I want
two plots of the same data. One a bar char, the other a line graph.
What I'm trying:
#MSU_graph_m1b <-
qplot(Int_Start,LicPrLsys4HMSU,data=cpprdald2_m1,geom="bar",stat="identity",color=System_alias);
MSU_graph_m1 <-
qqplot(cpprdald2_m1,aes(x=Int_Start,y=LicPrLsys4HSMU,colour=System_alias));
MSU_graph_m1b <- MSU_graph_m1+geom_bar();
#MSU_graph_m1l <- qplot(Int_Start,LicPrLsys4HMSU,data=cpprdald2_m1,geom="line");
MSU_graph_m1l <- MSU_graph_m1+geom_line();
The commented lines are what works. What fails is the first ggplit() like:
> MSU_graph_m1 <- qqplot(cpprdald2_m1,aes(x=Int_Start,y=LicPrLsys4HSMU,colour=System_alias));
Error in as.matrix.data.frame(x) :
dims [product 9912] do not match the length of object [9923]
>
cpprdald2_m1 is:
> str(cpprdald2_m1)
'data.frame': 168 obs. of 60 variables:
and Int_Start and LicPrLsys4HSMU are variables in cpprdald2_m1.
Int_Start is a POSIXlt. LicPrLsys4HSMU is a number. I have also tried
with x=as.character(Int_Start) in the aes().
I am using the book "R GRAPHICS COOKBOOK" as my source of examples. I
am obviously oblivious to something.
--
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan
Maranatha! <><
John McKown
More information about the R-help
mailing list