[datatable-help] keyby doesn't sort numeric keys
Chris Neff
caneff at gmail.com
Tue May 15 18:04:13 CEST 2012
Hey all,
Using the latest version, I get the following:
> dt=data.table(x=1:10,y=rnorm(10))
> dt[,list(count=.N),keyby=c("x","y")]
Finding groups (bysameorder=FALSE) ... done in 0.003 secs
Detected that j uses these columns (the rest, if any, are ignored for
efficiency):
Starting dogroups ...
testj evaluates to a list with names, this may slow down grouping...
done dogroups in 0.002 secs
x y count
[1,] 1 -0.43990011 1
[2,] 2 -0.74863035 1
[3,] 3 0.06791443 1
[4,] 4 0.32678061 1
[5,] 5 -0.77222679 1
[6,] 6 0.03435628 1
[7,] 7 0.35011434 1
[8,] 8 -0.46384714 1
[9,] 9 0.32989082 1
[10,] 10 -0.76977285 1
Note that the y values aren't sorted right. This output does have x
and y as keys though, and the data.table is left in a state with keys
that aren't sorted. Unless I misunderstand keyby, this is a bug no?
-Chris
More information about the datatable-help
mailing list