[datatable-help] `with=F` in the `i` Argument

Michael Smith my.r.help at gmail.com
Sat May 31 06:01:31 CEST 2014


All,

I'm trying to order the rows according to several columns at a time:

DT <- data.table(a = 1:4, b = 8:5)
for (i in c("a", "b"))
  print(DT[order(i), with = FALSE])

It doesn't work, since `with` seems to be about the `j` argument, but
not the `i` argument, according to `?data.table`.

I found the following workaround, but wonder whether there is a more
elegant way to do it:

for (i in c("a", "b"))
  print(DT[order(DT[, i, with = FALSE])])

Thanks,
M


More information about the datatable-help mailing list