It seems like setDT returns an error whenever you are trying to run it on a stored data in the datasets package. For example
library(data.table)
setDT(CO2)
## Error in assign(name, x, parent.frame(), inherits = TRUE) : 
##   cannot change value of locked binding for 'CO2'
The strangiest thing is that if you rerun setDT(CO2) it will work
So I've looked in the source code of setDT and tried to reproduce the error
x <- CO2
name <- as.character(substitute(x))
assign(name, x, parent.frame(), inherits = TRUE)
Which worked and didn't return any error. My guess is that the parent.frame() is the one that causing it, but I can't figure out by myself whats going on back stage. Also, I can't understand why setDT(CO2) doesn't return an error on the second run.
My sessionInfo()
## R version 3.0.3 (2014-03-06)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## 
## locale:
##   [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
## 
## attached base packages:
##   [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##   [1] data.table_1.9.2
## 
## loaded via a namespace (and not attached):
##   [1] plyr_1.8       reshape2_1.2.2 stringr_0.6.2  tools_3.0.3   
 
     
    