Skip to content

epi_df behavior for drop_na and pivot_*#692

Merged
brookslogan merged 13 commits intodevfrom
tidyr-met
Apr 20, 2026
Merged

epi_df behavior for drop_na and pivot_*#692
brookslogan merged 13 commits intodevfrom
tidyr-met

Conversation

@JavierMtzRdz
Copy link
Copy Markdown
Contributor

@JavierMtzRdz JavierMtzRdz commented Feb 28, 2026

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).
  • Styling and documentation checks. Make a PR comment with:
    • /style to check the style and fix any issues.
    • /document to check the package documentation and fix any issues.
    • /preview-docs to preview the docs.
    • See Actions GitHub tab to track progress of these commands.
  • See DEVELOPMENT.md for more information on the development
    process.

epi_df behavior for drop_na and pivot_* verbs

This PR includes methods for drop_na and pivot_* verbs.

drop_na

Always returns an epi_df, as it only subsets rows and does not remove essential key columns.

pivot_wider

pivot_wider method preserves the epi_df class as long as the geo_value and time_value columns are present in the output. It also automatically updates the other_keys metadata by removing any keys that were pivoted away or dropped during the transformation. However, the object will silently decay into a tibble if geo_value or time_value are used in names_from, as this removes them from the column set.

pivot_longer

The pivot_longer method automatically promotes the new names_to column to a key in the other_keys metadata. If the resulting data is not unique on its keys even after this promotion, the method will issue a warning and the object will decay into a tibble. Similar to pivot_wider, the result will silently become a tibble if the essential geo_value or time_value columns are pivoted away.

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

@JavierMtzRdz
Copy link
Copy Markdown
Contributor Author

/style

@JavierMtzRdz
Copy link
Copy Markdown
Contributor Author

/document

@JavierMtzRdz
Copy link
Copy Markdown
Contributor Author

/preview-docs

@github-actions
Copy link
Copy Markdown

@JavierMtzRdz JavierMtzRdz marked this pull request as ready for review March 2, 2026 14:59
@JavierMtzRdz JavierMtzRdz changed the title epi_df behavior for drop_na and pivot_* verbs epi_df behavior for drop_na and pivot_* Mar 2, 2026
Comment thread R/methods-epi_df.R Outdated
Comment thread R/methods-epi_df.R Outdated
Comment thread R/methods-epi_df.R Outdated
Comment thread R/methods-epi_df.R Outdated
Copy link
Copy Markdown
Contributor Author

@JavierMtzRdz JavierMtzRdz left a comment

Choose a reason for hiding this comment

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

I have included the suggestions from your review! No relevant comments about it this time.

Comment thread R/methods-epi_df.R Outdated
Comment thread R/methods-epi_df.R Outdated
Comment thread R/methods-epi_df.R Outdated
@JavierMtzRdz JavierMtzRdz requested a review from brookslogan April 3, 2026 01:14
@brookslogan brookslogan merged commit e319da0 into dev Apr 20, 2026
3 checks passed
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