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

Remove select.epi_df #507

Merged
merged 2 commits into from
Aug 9, 2024
Merged

Remove select.epi_df #507

merged 2 commits into from
Aug 9, 2024

Conversation

brookslogan
Copy link
Contributor

@brookslogan brookslogan commented Aug 9, 2024

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).
  • [-] Describe changes made in NEWS.md, making sure breaking changes
    (backwards-incompatible changes to the documented interface) are noted.
    Collect the changes under the next release number (e.g. if you are on
    1.7.2, then write your changes under the 1.8 heading).
  • See DEVELOPMENT.md for more information on the development
    process.

Change explanations for reviewer

  • The code for select.epi_df looked suspicious/weird without explanatory comments, and I don't want us to start basing other changes on it without in-source comments to explain the details... but now it turns out select.epi_df seems to be completely unnecessary now. (But at some point we needed patch: get select working with grouping #390... perhaps older dplyr versions resulted in a weird situation that no longer appears in more recent dplyr versions, but the fact that we needed it at some point makes me a bit nervous so:)
    • I've added a few more tests to try to make sure I'm not breaking things instead.
  • While attempting to test on older dplyr versions, other broken tests kept popping up before I got to tests of select, so I didn't fully track down the story here. But in response, I've bumped our dependency a little bit to 1.0.8, and adjusted some failing tests to work on that version (which had a more rigid if_else).

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

  • Resolves #{issue number}

`select.epi_df` looked weird:
- `reclass(selected, attr(selected, "metadata"))` would only have made sense if
  grouped_df had a `select` that dropped our class but not our metadata,
  implemented in a way that called our own impls for `dplyr_extending` that would
  make that metadata actually be correct (in the case of renaming).
- (`dplyr_reconstruct(selected, selected)` might have made sense, if `reclass`
  acted on something that shouldn't actually become an `epi_df`, decaying back to
  a non-`epi_df` only if needed.)

So it seemed like it relied on `dplyr_extending` being almost, but not quite,
sufficient. But it looks like `grouped_df` doesn't even have a `select` impl, so
it's not interfering anyway! So it looks like we can just get rid of our own
impl.
We need dplyr >= 1.0.8 for some dplyr_col_modify or something of the sort, used
by the column modifications recorder used by epi_archive.

(We also needed a more recent dplyr for if_any and if_all.)

Change some tests to actually run under dplyr 1.0.8, which was more rigid about
the types of things going into if_else.
@brookslogan
Copy link
Contributor Author

Hi @dshemetov & @dsweber2, it'd be great if one of you could sanity-check this and/or verify this isn't breaking things downstream in exploration-tooling.

Copy link
Contributor

@dshemetov dshemetov left a comment

Choose a reason for hiding this comment

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

Tested with rolling_mean and rolling_sd functions, which previously had to reconstruct the epi_df after a select, and it works well without it.

@brookslogan
Copy link
Contributor Author

Awesome, thanks for the quick review!

@brookslogan brookslogan merged commit 3430f0e into dev Aug 9, 2024
5 checks passed
@brookslogan brookslogan deleted the lcb/remove-select-epi-df branch August 9, 2024 02:40
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.

2 participants