Try

dt[(id) %in% smp, ]


On 01/15/2016 10:39 AM, Huashan Chen wrote:


dt = data.table(id=1:30, nn = paste0('A', 1:30))
smp = sample(30, size =10)

#  data is sorted as expected
aa = dt$id %in% smp
dt[aa, ]

# However, this gives unsorted result
dt[id %in% smp, ]

Is this a bug or by design?




--
View this message in context: 
http://r.789695.n4.nabble.com/possible-sort-bug-tp4716440.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to