Added format specifier for yearqtr#7713
Open
LunaticSage218 wants to merge 6 commits intoRdatatable:masterfrom
Open
Added format specifier for yearqtr#7713LunaticSage218 wants to merge 6 commits intoRdatatable:masterfrom
LunaticSage218 wants to merge 6 commits intoRdatatable:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7713 +/- ##
==========================================
- Coverage 99.04% 99.04% -0.01%
==========================================
Files 87 87
Lines 17037 17128 +91
==========================================
+ Hits 16874 16964 +90
- Misses 163 164 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ben-schwen
reviewed
Apr 21, 2026
Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
ben-schwen
reviewed
Apr 21, 2026
| yearqtr = function(x, format=c("numeric", "character")) { | ||
| format = match.arg(format) | ||
| if (format == "numeric") return(convertDate(as.IDate(x), "yearqtr")) | ||
| yr = convertDate(as.IDate(x), "year") |
Member
There was a problem hiding this comment.
we dont need 3 calls of as.IDate(x) and 2 calls of convertDate. Cache them if necessary and calulate the Quarter als round((yqtr - floor(yqtr)) * 4) + 1L
ben-schwen
reviewed
Apr 21, 2026
|
|
||
| 9. `fread()` no longer replaces a literal header column name `"NA"` with an auto-generated `Vn` name when `na.strings` includes `"NA"`, [#5124](https://github.com/Rdatatable/data.table/issues/5124). Data rows still continue to parse `"NA"` as missing. Thanks @Mashin6 for the report and @shrektan for the fix. | ||
|
|
||
| 10. `yearqtr()` now accepts an optional format specifier [#7694](https://github.com/Rdatatable/data.table/issues/7694). 'numeric' is the deafult, which preserves the original behavior, but 'character' formats the date like so: YYYYQ# (e.g. 2025Q2). Thanks to @jan-swissre for the report and @LunaticSage218 for the implementation. |
Member
There was a problem hiding this comment.
at least a typo in default.
Suggested change
| 10. `yearqtr()` now accepts an optional format specifier [#7694](https://github.com/Rdatatable/data.table/issues/7694). 'numeric' is the deafult, which preserves the original behavior, but 'character' formats the date like so: YYYYQ# (e.g. 2025Q2). Thanks to @jan-swissre for the report and @LunaticSage218 for the implementation. | |
| 10. `yearqtr()` gains an optional `format` argument [#7694](https://github.com/Rdatatable/data.table/issues/7694). 'numeric' is the deafult, which preserves the original behavior, but 'character' formats the date like so: YYYYQ# (e.g. 2025Q2). Thanks to @jan-swissre for the report and @LunaticSage218 for the implementation. |
Member
|
Solid first approach. Keep in mind that we strive for efficiency with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to data.table!
Please be sure to read our CONTRIBUTING guide. In particular, "Contributors are requested not to use code assistants if they are not able to evaluate license of the code provided by an assistant, and to provide proper citation."