You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combining the atomic plot2.default method with a facet formula doesn't work at all.
with(
aq,
plot2(
Ozone,
type="density",
facet=windy~hot,
fill="by",
grid=TRUE, frame=FALSE,
main="Ozone pollution is worse on hot, calm days"
)
)
#> Error in density.default(x): 'x' contains missing values
Retrying with plot2.formula kinda works, but not actually because the splits aren't correct. (There are missing data mismatches.) So the distributions aren't actually correct. Furthermore, the order of facets is wrong (it's no longer a facet grid) and the titles haven't been parsed correctly.
plot2(
~Ozone,
data=aq,
type="density",
facet=windy~hot,
fill="by",
# the rest of these arguments are optional...grid=TRUE, frame=FALSE,
main="Ozone pollution is worse on hot, calm days"
)
#> Warning in split.default(x, f = facet): data length is not a multiple of split#> variable
Subsetting ahead of time actually "works", insofar as it produces the right plots... but again the facet grid layout has not been parsed correctly.
plot2(
~Ozone,
data= subset(aq, !is.na(Ozone)),
type="density",
facet=windy~hot,
fill="by",
# the rest of these arguments are optional...grid=TRUE, frame=FALSE,
main="Ozone pollution is worse on hot, calm days"
)
In summary: There are a couple of things happening here. One is that the na.action / na.omit steps aren't equal, e.g. when constructing model frames from formulae. So we get mismatches if either the main (x/y/formula) or facet variables have missing observations. Another is that the grid layout has been lost along the way, likely because of splitting/recombining the facet variables in the plot2.density logic (which is unavoidable, but causes them to lose some attributes).
The text was updated successfully, but these errors were encountered:
Combining the atomic
plot2.default
method with a facet formula doesn't work at all.Retrying with
plot2.formula
kinda works, but not actually because the splits aren't correct. (There are missing data mismatches.) So the distributions aren't actually correct. Furthermore, the order of facets is wrong (it's no longer a facet grid) and the titles haven't been parsed correctly.Subsetting ahead of time actually "works", insofar as it produces the right plots... but again the facet grid layout has not been parsed correctly.
Created on 2024-01-25 with reprex v2.0.2
In summary: There are a couple of things happening here. One is that the
na.action
/na.omit
steps aren't equal, e.g. when constructing model frames from formulae. So we get mismatches if either the main (x/y/formula) or facet variables have missing observations. Another is that the grid layout has been lost along the way, likely because of splitting/recombining the facet variables in theplot2.density
logic (which is unavoidable, but causes them to lose some attributes).The text was updated successfully, but these errors were encountered: