This question is not a duplicate of Error in setDT
from data.table
package.
library(data.table)
dt <- iris
str(iris) # a data.frame solely
setDT(dt)
str(iris) # data.frame and data.table
Why should setDT()
act on an object that is not its argument?
Thank you all for pointing out why iris is changed in parallel with dt. Unless one knew the answer already, there would be no way to know that the question was a duplicate.