Re: [R] use ggplot in a function to which a column name is given

From: hadley wickham <h.wickham_at_gmail.com>
Date: Thu, 13 Dec 2007 09:43:05 -0600

> great! I knew you would have thought this through. That's perfect. As
> always there's the trade-off between writing code and documenting the
> code already written. In this case the trade-off turned toward the
> code part I guess.
>
> Autodetection of strings by aes would be even greater but that would
> prevent me to assign the actual strings "u", "x", "y" to an aes
> element, which I don't see as a problem for non text related functions
> though...

It can come in handy when combining multiple datasets:

mtcarsq <- as.data.frame(mtcars ^ 2)

ggplot(mtcars, aes(x=mpg, y=wt)) + geom_point(aes(colour = "Raw")) + geom_point(aes(colour="Squared"), data=mtcarsq)

and aes is complicated enough as it is.

Hadley

-- 
http://had.co.nz/

______________________________________________
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 13 Dec 2007 - 15:46:29 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 13 Dec 2007 - 16:30:18 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.