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

Dev #25

Closed
wants to merge 17 commits into from
Closed

Dev #25

wants to merge 17 commits into from

Conversation

TimTaylor
Copy link
Collaborator

@TimTaylor TimTaylor commented Sep 24, 2024

This PR overhauls the implementation and interface of add_parent_interval() and merge_episodes():

  • The merge_episodes() generic has had it's signature tweaked to widen how it can be used. This has been done with the addition of a default method that consequently means the following are equivalent:
with(dat, merge_episodes(id, start, end))
reframe(dat, merge_episodes(id, start, end))
merge_episodes(dat, "id", "start", "end")
  • add_parent_interval() has been updated in a similar fashion.

  • For both merge_episodes() and add_parent_interval(), the id argument can now be of length greater than one. In essence this is akin to constructing unique identifiers across multiple variables (I'm unsure if this is useful or not at the moment). EDIT: This wasn't fully implemented and think it is best left to the user to ensure in hindsight. Have removed partial implementation.

  • BREAKING CHANGE: merge_episodes and add_parent_interval() now require column names to be explicitly stated for the data frame methods. I.e. Where, in the previous release, merge_episodes(dat) would have defaults "id", "start" and "end" for the id, start and end arguments, this would now be written as merge_episodes(dat, "id", start", "end").

  • Input checking and subsequent error signalling has been improved.

  • In merge_episodes() we now catch errors from calling add_parent_interval() and chain together for a more useful output.

  • Return to using the cli package for error signalling/messaging.

  • C code for .calculate_parent() has been made more robust.

  • BREAKING CHANGE: For both merge_episodes() and add_parent_interval(), users can now control the output column names. These arguments have been given slightly different defaults to what was set automatically in the previous version (hence the breaking change warning).

Tests have been updated accordingly but are still rather lacking (hoping to address this in future commits in this PR).
EDIT: Tests now updated.

This commit overhauls the implementation and interface of
`add_parent_interval()` and `merge_episodes()`:

- The `merge_episodes()` generic has had it's signature
  tweaked to widen how it can be used. This has been done
  with the addition of a default method that consequently
  means the following are equivalent:

  with(dat, merge_episodes(id, start, end))
  reframe(dat, merge_episodes(id, start, end))
  merge_episodes(dat, "id", "start", "end")

  `add_parent_interval()` has been updated in a similar
  fashion.

- Breaking change: `merge_episodes` and `add_parent_interval()`
  now require column names to be explicitly stated for
  the data frame methods.

  I.e. Where, in the previous release, merge_episodes(dat)
  would have defaults "id", "start" and "end" for the
  `id`, `start` and `end` arguments this  would now be
  written as merge_episodes(dat, "id", "start", "end").

- Input checking and subsequent error signalling has been
  improved.

- C code for .calculate_parent() has been made more robust.

- Tests have been updated accordingly but are still rather
  lacking (hoping to address this in future commits).
- Use cli for error messaging.
- In `merge_episodes()` we not catch from calling add_parent_interval()
  and chain together for a more useful output.
- General tweaks to messages for clarity.
@TimTaylor TimTaylor requested review from Lextuga007 and removed request for Lextuga007 September 24, 2024 14:36
@TimTaylor
Copy link
Collaborator Author

@Lextuga007 - this is the sort of thing I've been mulling over for the refactor. Marking as draft for the time being to get your thoughts.

@TimTaylor TimTaylor marked this pull request as ready for review September 25, 2024 10:32
NEWS.md Outdated Show resolved Hide resolved
NEWS.md Show resolved Hide resolved
README.Rmd Show resolved Hide resolved
@TimTaylor
Copy link
Collaborator Author

@Lextuga007 - I'm going to close this for the moment but keep working on the same dev branch with a slightly revised implementation that utilises tidyselect/non-standard evaluation (per our slack musings). Will do another PR (probably next week now though).

@TimTaylor TimTaylor closed this Sep 27, 2024
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