[R] gplot problems with faceting

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Feb 27 11:22:24 CET 2009


Dear Pascal,

I thik you need to define the facets as
	facets = ~ Par 
Instead of
	facets = Par ~ .

The Par ~ . Syntax can be used with facet_grid and not with facet_wrap.

HTH,

Thierry


----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 
www.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 at r-project.org [mailto:r-help-bounces at r-project.org] Namens BOISSON, Pascal
Verzonden: donderdag 26 februari 2009 17:08
Aan: r-help at r-project.org
Onderwerp: [R] gplot problems with faceting

Dear R-Listers,

I am very confused with what seems to be a misuse of the faceting options with gplot function and I hope you might help me on this.

z contains various simulation results from simulations with different set of parameters.
I melt my data to have the following data.frame structure : 

> str(z)
'data.frame':   12383 obs. of  5 variables:
 $ vID      : num  1 2 3 4 5 6 7 8 9 10 ...
 $ Var      : Factor w/ 61 levels ".t",".ASU_1.Biofilm_C",..: 1 1 1 1 1 1 
 $ Var.Value: num  317 318 319 320 319 ...
 $ Par      : Factor w/ 7 levels ".Biostyr0d.t_K",..: 1 1 1 1 1 1 1 1 
 $ Par.Value: num  5 5 5 5 5 5 5 5 5 5 ...

I would like to plot for each couple (Parameter(i), Variable(j)) the plot Variable(j).value = f(Parameter(i).Value.
I would like to do it step wise and have one set of graphs per Variable.
Then I subset z based on a single variable name eg ".ASU_1.Biofilm_C"

Then I try the following, but I get an error message :

> qp<- qplot(Par.Value, Var.Value, data = z[z$Var==v,], ylab=v, geom=c("point","smooth"), method="lm")
> qp<- qp + facet_wrap( facets= Par~ ., scales = "free_x", ncol=length(vPar))
> qp
Erreur dans `[.data.frame`(plot$data, , setdiff(cond, names(df)), drop = FALSE) : 
  colonnes non définies sélectionnées

I can have this working by modifying the facets arguments to "Par~Var", and it does what I want, 
But it is not satisfying, and I am confused with this error message.
The same error message happens when I use the full data frame. 
Or when I try other mappings like colors = Par

Any idea of what I am doing wrong?

Best regards
Pascal Boisson
___________________________________________________________________________________

Protegeons ensemble l'environnement : avez-vous besoin d'imprimer ce courrier electronique ?
___________________________________________________________________________________

Les informations figurant sur cet e-mail ont un caractere strictement confidentiel et sont exclusivement adressees au destinataire mentionne ci-dessus.Tout usage, reproduction ou divulgation de cet e-mail est strictement interdit si vous n'en etes pas le destinataire. Dans ce cas, veuillez nous en avertir immediatement par la meme voie et detruire l'original. Merci.

This e-mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. 
Any use, distribution or copying of this e-mail communication is strictly prohibited if you are not the addressee. If so, please notify us immediately by e-mail, and destroy the original. Thank you.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

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