-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
In ?setorder::Usage, we have:
Lines 32 to 33 in 566bff0
| # optimised to use data.table's internal fast order | |
| # x[order(., na.last=TRUE)] |
But x[order(., decreasing = TRUE)] is also optimized. Using the example from ?setorder:
set.seed(45L)
DT = data.table(A=sample(3, 10, TRUE),
B=sample(letters[1:3], 10, TRUE), C=sample(10))
DT[order(C, decreasing = TRUE), verbose = TRUE]
# order optimisation is on, i changed from 'order(...)' to 'forder(DT, ...)'.
# A B C
# 1: 1 b 10
# 2: 2 a 9
# 3: 2 b 8
# 4: 1 a 7
# 5: 2 b 6
# 6: 1 a 5
# 7: 1 c 4
# 8: 1 c 3
# 9: 2 b 2
# 10: 1 b 1
So I guess the documentation should mention this.
jangorecki