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

fullseq() sorts range #463

Merged
merged 4 commits into from
Oct 22, 2024
Merged

fullseq() sorts range #463

merged 4 commits into from
Oct 22, 2024

Conversation

teunbrand
Copy link
Contributor

This PR aims to fix #435.

Briefly, fullseq() now sorts the input range before doing the calculation. This prevents errors about the sign of the by argument.

Comment on lines -20 to -21
x <- as.Date("2012-01-01") + 1:30
expect_equal(fullseq(x, "1 month"), as.Date(c("2012-01-01", "2012-02-01")))
Copy link
Contributor Author

@teunbrand teunbrand Oct 8, 2024

Choose a reason for hiding this comment

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

This test was wonky. fullseq() only considers range[1] and range[2], but this is a vector of 30 dates instead of a range of 2 dates.

In addition, ceiling_date("2012-01-01", "1 month") gives 1st of March because 31 days from the end of January is in March due to February typically having only 28 days. I consider this out of scope for this PR, but it isn't doing any real harm anyway.

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasp85 thomasp85 merged commit f0cd669 into r-lib:main Oct 22, 2024
2 checks passed
@teunbrand teunbrand deleted the reverse_breaks_width branch October 22, 2024 07:50
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.

breaks_width() does not work with reverse transform
2 participants