-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facetting with complex expressions does not skip layers with missing data #2689
Comments
@lionel- can you take a look at this one too please? |
@hadley What are the semantics for layers with data? should we have the ggplot data as an intermediate mask, so that |
Hmmm, I think that's right — although to preserve the existing semantics that environment would binding every existing variable to |
@mundl Are you sure this used to work? I get the same results with CRAN ggplot2. @hadley We want the same evaluation semantics as in the last version right? It doesn't seem merging the layer data frames would be much of an improvement since it only makes sense in the particular case where they have the same number of rows. |
Ah I get it now, this is about ignoring facet specifications that refer to variables that do not exist in the current layer. I think we can pull this off by defining active bindings for all variables in the Only downside: this prevents referring to variables from the environment. But you'll still be able to unquote those. |
I think if they’re bound to NULL that will achieve the same effect. But if this isn’t a regression, there’s no need to work on now. |
Simple variables already work, this is about giving complex expressions the same semantics. |
When we fix this it'd be a good time to refactor the facetting code so the variables are evaluated only once. In the example above I see 5 evaluations of the |
The vetoed portion of the PR for #2693 may help with this...I put it in a gist as it didn't end up in the PR: https://gist.github.com/paleolimbot/832d30625d2cd46f39086228355a9dc0 |
This was fixed in #3757! |
Works as expected, points and polygons (same across facets) are drawn.
Using any function inside
vars()
or simplyvars((class))
gives an error.Using the same code from above but not specifying a
data
argument ingeom_polygon()
works.Session info
The text was updated successfully, but these errors were encountered: