You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DT = data.table(a = factor(c('a', 'b'), levels = c('b', 'a')))
split(DT, by = 'a', sorted = TRUE)
# $a
# a
# 1: a
# $b
# a
# 1: b
split(DT, f = DT$a, sorted = TRUE)
# $b
# a
# 1: b
# $a
# a
# 1: a
split.data.frame(DT, f = DT$a)
# $b
# a
# 1: b
# $a
# a
# 1: a
The text was updated successfully, but these errors were encountered:
AFAIR when using f argument then sorted is ignored. I don't see the point in extending f use case features when it is recommended to use by. f is less efficient, it is there so data.frame code can work with data.table method. Using by here is solution good enough, correct?
@jangorecki I should have added more exposition. the focus is the first example, where I use by but the output order is incorrect. But the order IS correct when I use f not by
@jangorecki check my PR. You're right that if we use f it's going to be less efficient, since internally it basically just passes to split.data.frame in this case.
However as mentioned, what I was intending to do was indeed use by, but it was giving incorrect output. That should be fixed now.
Pretty self-explanatory. MWE:
The text was updated successfully, but these errors were encountered: