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.
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
base: master
Are you sure you want to change the base?
add sort_by.data.table #6679
Changes from 1 commit
6082852
1a15902
bdb2e2d
fe8f6f1
bc3a413
fae047b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 2535 in R/data.table.R
GitHub Actions / lint-r
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.
Needs a few more tests -- currently all cases use the formula interface.
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.
Added some tests for other interfaces
https://github.com/Rdatatable/data.table/blob/bc3a413d1912340f93b1b50004a04a3b1ca2b485/inst/tests/tests.Rraw#L20711-L20725
Some questions arose to me
sort_by.data.frame
base method uses.formula2varlist()
, which is a public but "internal" base package, that as the manpage says,we can use that in
sort_by.data.table
right?forder
treats a list like a dt itself, the result may have the same number of rows as elements each vector of the sorting list. Nevertheless this is the same behaviour as dt[order(x)] where x is a list column.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.
Hmm, thanks for flagging. Actually, I'm not concerned so much about that, but you did make me remember that it's a pretty new {base} function. It won't be available in all the R versions we support --> will cause an
R CMD check
NOTE
there.And actually, we've crossed this bridge before in #5393:
data.table/R/data.table.R
Lines 2460 to 2465 in d263924
So actually, we should just make a local copy of
.formula2varlist()
to re-use betweensplit.data.table
andsort_by.data.table
.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.
As long as the behavior is consistent with
[order(...)]
I think we can ignore it in this PR.