-
Notifications
You must be signed in to change notification settings - Fork 1k
order optimizes to forderv, uses key or index, forder more consistent to base order #4458
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4458 +/- ##
==========================================
- Coverage 99.61% 99.59% -0.02%
==========================================
Files 72 72
Lines 13917 13967 +50
==========================================
+ Hits 13863 13911 +48
- Misses 54 56 +2
Continue to review full report at Codecov.
|
| o | ||
| if (!is.logical(decreasing) || anyNA(decreasing)) stop("'decreasing' must be logical non-NA") | ||
| if (length(decreasing)!=1L && length(decreasing)!=length(data)) stop("'decreasing' must be either length 1, or length of the variables passed to [f]order") | ||
| asc[decreasing] = -(asc[decreasing]) |
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.
[.integer automatically recycle scalar decreasing
|
marking as WIP because it will need rebase over lazy-forder branch |
Closes:
DT[order(.)]could utilize existing indexordercould utilize existing index #3023 (once Teach forder to re-use existing key and index attributes instead of sorting from scratch #4386 merged) - this one and the next, setindex, is being tested on lazy-forder branch after merging this PR inopt-order-lazybranchDT[order(.), ...]could create index on DTDT[order(.), ...]could create index on DT #3261 (once Teach forder to re-use existing key and index attributes instead of sorting from scratch #4386 merged, andsetindexfrom C forder enabled)fordermanual, doesn't have to be exported, a lot to migrate fromsetorder.Rd, partly done in setorderv gets new arg neworder, closes #4012 #4340To reduce number of API changes (in still internal
forder[v]) I am not going to yet close this issue:It is partially addressed by making
fordercompatible withbase::order, but this PR does not restrict input types. Lets see what base R is planning to do aboutorder(df)(see R-devel discussion), and in another iteration we can solve #4346 and #4214.It also makes
na.last=NAoption inforderconsistent to baseorderby removing 0's that are result fromforderv(na.last=NA).