I\'m unsure how to facet by a function of the data in the data
element of a ggplot
object. In the following toy example, what I want to do is some
this sounds familiar to me, but I never managed to fix it - I think facet variable handling is just less powerful than aesthetic variable handling.
Addressing your root requirement - to ad-hoc facet an existing ggplot; note that you can replace wholesale the (master) data set of an existing R
ggplot - for instance
myplot %+% transform(myplot$data, z=z%%2)