[R] ggplot2 argument handling odd

Sebastian Weber sebastian.weber at physik.tu-darmstadt.de
Thu Mar 27 08:26:21 CET 2008


Hi!

> In this case you are better off moving away from qplot (which does
> various substitute tricks to assemble the named variables in a data
> frame) to a more explicit form of ggplot:
> 
> pl2[[obs]] <- ggplot(cData, aes_string(x="x3", y=obs)) + geom_point()
> + opts(title = obs)

Ok, I will try that, thanks. BTW, where is this aes_string option
documented, sounds useful? How could I do the same thing with facetting?
If I want to save something like ". ~ groupVar" as a string in a
variable, could I pass it with facet_string to ggplot?

But anyway, I would be curious how to do it with qplot. The basic
question is: How to pass the string of a variable to a function which is
supposed to interpret it. Aka:

var <- "magicVar"

fun(doSomeMagic(var))

doSomeMagic should then write magicVar at the place.

Greetings,

Sebastian Weber

> 
> Hadley
> 
>



More information about the R-help mailing list