FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added format specifier for yearqtr by LunaticSage218 · Pull Request #7713 · Rdatatable/data.table · GitHub

Added format specifier for yearqtr - #7713

Merged
ben-schwen merged 6 commits into
Rdatatable:masterfrom
LunaticSage218:master
Apr 27, 2026
Merged

ben-schwen merged 6 commits into
Rdatatable:masterfrom
LunaticSage218:master

Conversation

LunaticSage218 commented Apr 21, 2026
edited by ben-schwen
Loading

Copy link
Copy Markdown
Contributor

Closes #7694

codecov Bot commented Apr 21, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.04%. Comparing base (3a45206) to head (142b381).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7713   +/-   ##
=======================================
  Coverage   99.04%   99.04%           
=======================================
  Files          87       87           
  Lines       17123    17058   -65     
=======================================
- Hits        16959    16895   -64     
+ Misses        164      163    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread man/IDateTime.Rd Outdated
Comment thread R/IDateTime.R Outdated
Comment thread NEWS.md Outdated

Copy link
Copy Markdown
Member

Solid first approach. Keep in mind that we strive for efficiency with data.table so before calculating smth twice in a short period, we most of the time cache it.

Comment thread inst/tests/tests.Rraw Outdated
Comment thread man/IDateTime.Rd

ben-schwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We are close to being mergeable.

However, to fully close the issue you would also need to mirror the approach for yearmon with a similar encoding d="2019-01-01" as yearmon(d, "character") as "2019M1"

Comment thread R/IDateTime.R Outdated
Comment thread man/IDateTime.Rd Outdated
\item{units}{one of the units listed for truncating. May be abbreviated.}
\item{ms}{ For \code{as.ITime} methods, what should be done with sub-second fractions of input? Valid values are \code{'truncate'} (floor), \code{'nearest'} (round), and \code{'ceil'} (ceiling). See Details. }
\item{format}{format is either \code{"numeric"} (default) or \code{"character"}. \code{"character"} formats the result as \code{"2025Q4"}.}
\item{format}{format is either \code{"numeric"} (default) or \code{"character"}. \code{"character"} formats the result as \code{"2025M4"} for \code{yearmon} and \code{"2025Q4"} for \code{yearqtr}.}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

2025M04
Otherwise sorting character will be not as user expects, unless we go for format=factor where we can define order

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe

ans[ok] = sprintf("%dM%02d", as.integer(yr), as.integer(mon))

so if a user sorts on the last two characters it's always integers?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe

ans[ok] = sprintf("%dM%02d", as.integer(yr), as.integer(mon))

so if a user sorts on the last two characters it's always integers?

Yeah, thats exactly what I would do!

Comment thread NEWS.md Outdated

ben-schwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Last minor tweaks about coding style and docs.

Basically LGTM, TY!

Comment thread R/IDateTime.R Outdated
Comment thread R/IDateTime.R Outdated
Comment thread R/IDateTime.R Outdated
Comment thread man/IDateTime.Rd Outdated
ben-schwen merged commit da0d15e into Rdatatable:master Apr 27, 2026
2 of 3 checks passed

LunaticSage218 commented Apr 27, 2026 via email

Copy link
Copy Markdown
Contributor Author

skitsy24 pushed a commit to skitsy24/data.table that referenced this pull request May 13, 2026
* Restore files to state at 6d0dd35

* fix typo

* fix coding style

* fix coding style

* unify approaches

* small docs tweak

---------

Co-authored-by: Benjamin Schwendinger <52290390+ben-schwen@users.noreply.github.com>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yearqtr() could optionally output 2025Q4 format

3 participants


Back | FazBrowse Home | New Git URL