Open gergness opened 3 years ago
Initial attempts at this have failed because dplyr:::compute_groups
(called from dplyr::group_by
) recreates the factor vector without considering additional metadata.
Might be worth asking tidyverse team if it could preserve metadata here (I don't totally understand this code, seems like there should be a cleaner way that preserves metadata, which would help with the factor vs ordered distinction) https://github.com/tidyverse/dplyr/blob/86a8455fed6b763927be06a0fbe685444442bc9f/R/grouped-df.r#L78
If you're grouping by an
interact
variable, it's not possible to avoid dropping missing levels.Created on 2021-11-07 by the reprex package (v2.0.1)