# example data
DT = data.table(iris)
To modify factor levels by reference, use setattr:
setattr(DT$Species, "levels", c("set", "ver", "vir")
# or
DT[, setattr(Species, "levels", c("set", "ver", "vir"))]
The sec...