[R] Trying to change a qplot() to a ggplot()+

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Jul 23 16:00:52 CEST 2014

It is ggplot (double G), not qqplot (double Q)

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org] Namens John McKown
Verzonden: woensdag 23 juli 2014 15:48
Aan: r-help
Onderwerp: [R] Trying to change a qplot() to a ggplot()+

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 <-

MSU_graph_m1   <-

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

R-help op r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.

More information about the R-help mailing list