Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread baptiste auguie
Now why do I always come up with a twisted bquote() where a simple paste() would do! Thanks, baptiste 2009/10/5 hadley wickham : >> Whether or not what follows is to be recommended I don't know, but it >> seems to work, >> >> p <- ggplot(diamonds, aes(carat, ..density..)) + >>  geom_histogram(b

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread hadley wickham
> Whether or not what follows is to be recommended I don't know, but it > seems to work, > > p <- ggplot(diamonds, aes(carat, ..density..)) + >  geom_histogram(binwidth = 0.2) > > x = quote(cut) > facets = facet_grid(as.formula(bquote(.~.(x > p + facets That's what I'd recommend. You can also

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread baptiste auguie
Hi, Whether or not what follows is to be recommended I don't know, but it seems to work, p <- ggplot(diamonds, aes(carat, ..density..)) + geom_histogram(binwidth = 0.2) x = quote(cut) facets = facet_grid(as.formula(bquote(.~.(x p + facets HTH, baptiste 2009/10/5 Bryan Hanson : > Thanks

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread Bryan Hanson
Thanks Thierry for the work-around. I was out of ideas. I had looked around for the facet_grid() analog of aes_string(), and concluded there wasn't one. The only thing I found was the notion of facet_grid("...") but apparently it is intended for some other use, as it doesn't work as I thought i

Re: [R] ggplot2: proper use of facet_grid inside a function

2009-10-05 Thread ONKELINX, Thierry
Dear Bryan, In the ggplot() function you can choose between aes() and aes_string(). In the first you need to hardwire the variable names, in the latter you can use objects which contain the variable names. So in your case you need aes_string(). Unfortunatly, facet_grid() works like aes() and not