hadley / ggplot2-book

ggplot2: elegant graphics for data analysis
https://ggplot2-book.org/
1.57k stars 683 forks source link

facet chapter still uses the classic formula-based interface #342

Open djnavarro opened 1 year ago

djnavarro commented 1 year ago

need to switch from facet_grid(a ~ b) to facet_grid(rows = vars(a), cols = vars(b)) etc

hadley commented 1 year ago

FWIW I think we're rather lukewarm on the new syntax, so I wouldn't go out of my way to switch to it.

djnavarro commented 1 year ago

Noted 😁

I actually don't mind the new syntax. It is clunky in some ways, but I feel that's a consequence of vars()? The two-sided formula version was always a headache for me: I never had a good way of remembering whether LHS maps to rows or columns. But point taken... there are higher priorities!

hadley commented 1 year ago

I think if we were to do this again it would be facet_grid(rows = a, cols = b), but we can't easily back out of the vars() syntax 😬