Say we had
DT <- data.table(a = c("a", "b", "c"), b = 1:3)
And we wanted
data.frame(b = 1:3, row.names = c("a", "b", "c"))
It seems we could do this all by reference via:
rn <- DT$a
DT[ , a := NULL]
setDF(DT, rownames = rn)
Seems natural to implement this via
setDF(DT, rownames = "a")
Or else add an argument:
setDF(DT, to.row.names = "a")
Say we had
And we wanted
It seems we could do this all by reference via:
Seems natural to implement this via
Or else add an argument: