Skip to content
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

Djm/as tibble attr #471

Merged
merged 12 commits into from
Jun 21, 2024
Merged

Djm/as tibble attr #471

merged 12 commits into from
Jun 21, 2024

Conversation

dajmcdon
Copy link
Contributor

Checklist

Please:

  • Make sure this PR is against "dev", not "main" (unless this is a release
    PR).
  • Request a review from one of the current main reviewers:
    brookslogan, nmdefries.
  • Makes sure to bump the version number in DESCRIPTION. Always increment
    the patch version number (the third number), unless you are making a
    release PR from dev to main, in which case increment the minor version
    number (the second number).
  • See DEVELOPMENT.md for more information on the development
    process.

Change explanations for reviewer

Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

@dajmcdon dajmcdon requested a review from brookslogan June 21, 2024 00:53
brookslogan added a commit that referenced this pull request Jun 21, 2024
Copy link
Contributor

@brookslogan brookslogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach looks nice, we get to keep sane behavior for users that take it as_tibble() by its name. I added a bit of roxygen, NEWS.md, and conditional attr printing to make it less mysterious.

Question: how do you want propagation for this attribute to work? It looks like there is some amount of propagation already, e.g., surviving through mutate(), but it does not survive via |> group_by(geo_value) |> ungroup() (unlike our metadata). (And there are still other cases (e.g., #250) where our metadata / epi_dfness doesn't survive when we'd want it to.) If you want it to be hardier, then it probably belongs within metadata + a double-check of whether reclass() and dplyr_reconstruct.epi_df() do indeed propagate it then.

@dajmcdon
Copy link
Contributor Author

dajmcdon commented Jun 21, 2024

My thinking on grouping: since as_tibble(regular_tibble) drops the grouping, this should as well for now. I wanted the deviations from expected behaviour to be as minimal as possible while being sufficient for my needs. However, (not yet encountered by me) maybe grouping dropping/maintaining is part of the fix for cmu-delphi/epipredict#336. I'll get there next I think.

I suppose an external user could want this functionality, but providing it seems likely to be very low on the pile of issues until someone asks.

@dajmcdon dajmcdon merged commit 99d3e1c into dev Jun 21, 2024
5 checks passed
@dajmcdon dajmcdon deleted the djm/as_tibble-attr branch June 21, 2024 15:56
@brookslogan
Copy link
Contributor

brookslogan commented Jun 21, 2024

I didn't mean that we shouldn't drop the grouping with as_tibble(). I meant that grouping & ungrouping (and likely various other operations) drops the decay_to_tibble attribute. [I'd guess not much recipes stuff actually groups and ungroups. But there could be other tidyverse operations that are used that do have the same thing happen.]

@dajmcdon
Copy link
Contributor Author

Oh, I see. Yes, I'm hopeful that there's no grouping on internally that will screw me up. But good to have a record here in case it does!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do we need as_tibble() to drop the class?
2 participants