[R] gplot problems with faceting

BOISSON, Pascal Pascal.BOISSON at veolia.com
Thu Feb 26 17:07:42 CET 2009


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.




More information about the R-help mailing list