For efficiency, data.table offers a way of altering a data.frame or list to make a data.table in-place:
# example data.frame
DF = data.frame(x = letters[1:5], y = 1:5, z = (1:5) > 3)
# modification
setDT(DF)
Note that we do not <- assign the result, since the object DF has been modifi...