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
iment died of. >> ~ Sir Ronald Aylmer Fisher >> >> The plural of anecdote is not data. >> ~ Roger Brinner >> >> The combination of some data and an aching desire for an answer does not >> ensure that a reasonable answer can be extracted from a given body

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

2009-10-05 Thread Bryan Hanson
reasonable answer can be extracted from a given body of > data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Bryan Hanson > Verzonden: vrijdag 2 oktober 2009 17:21 > Aan: Onderwerp:

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

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

2009-10-02 Thread Bryan Hanson
Hello Again R Folk: I have found items about this in the archives, but I’m still not getting it right. I want to use ggplot2 with facet_grid inside a function with user specified variables, for instance: p <- ggplot(data, aes_string(x = fac1, y = res)) + facet_grid(. ~ fac2) Where data, fac