-
Notifications
You must be signed in to change notification settings - Fork 1k
add sort_by.data.table #6679
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
add sort_by.data.table #6679
Conversation
Generated via commit ee44ef4 Download link for the artifact containing the test results: ↓ atime-results.zip
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think it needs an entry in man/, probably in ?forder
would be the most logical place?
Added a reference in setorder.Rd (?forder). PTAL. |
man/setorder.Rd
Outdated
@@ -32,6 +33,7 @@ setorderv(x, cols = colnames(x), order=1L, na.last=FALSE) | |||
# optimised to use data.table's internal fast order | |||
# x[order(., na.last=TRUE)] | |||
# x[order(., decreasing=TRUE)] | |||
# sort_by(x, ., na.last=TRUE, decreasing=FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMIIW, we leave this as a comment instead of \method{sort_by}{data.table}
because the method is not available in all supported R versions, is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello. I simply put another use case, these are provided as comments and printed verbatim (as comments) in manpages.
However now that you mention this, I clarified that those references to sort_by are only R>=4.4.0
Ah, unfortunately because of r-lib/covr#567 we won't get coverage of this code yet -- the coverage runner is stuck on an R version before |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still unsure if we should try something to ensure \method{sort_by}{data.table}(x, \dots)
is used "properly", but anyway LGTM, thanks!!
I noticed {maditr} also defines https://github.com/gdemin/maditr/blob/a4df8cccfe5ca5c8a919c6b6be2eb0e238c8866b/NAMESPACE#L19 cc @gdemin I suppose that will cause breakage on release. Anyway, there the https://github.com/gdemin/maditr/blob/a4df8cccfe5ca5c8a919c6b6be2eb0e238c8866b/man/let_if.Rd#L27 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6679 +/- ##
==========================================
- Coverage 98.64% 98.60% -0.05%
==========================================
Files 79 79
Lines 14650 14656 +6
==========================================
Hits 14452 14452
- Misses 198 204 +6 ☔ View full report in Codecov by Sentry. |
I've tried \method{sort_by}{data.table}(x, y, \dots) together with
\alias{sort_by.data.table} and, surprisingly, it just worked on both
R-4.2.2 and R-3.3.0. There's no need for scary-looking kludges like
\if{\Sexpr[stage=install,results=rd]{as.character(exists("sort_by",
"package:base"))}{\method{...}}. R CMD check only verifies that all
exported symbols are documented, not that all documented aliases are
exported (or even exist in the namespace).
The old versions of R do complain about missing .formula2varlist.
|
Proposal for #6662
sort_by.data.table()
will sort using C-locale now, this is incompatible withbase::sort_by.data.frame()
used on data.tables