Re: [R] ggplot2 argument handling odd

From: Sebastian Weber <sebastian.weber_at_physik.tu-darmstadt.de>
Date: Thu, 27 Mar 2008 08:26:21 +0100

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



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. Received on Thu 27 Mar 2008 - 07:31:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 27 Mar 2008 - 17:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive