I got bitten badly when a variable I created for the purpose of
recording an old set of names changed when I didn't think I was going
near it.
I'm not sure if this is a desired behaviour, or documented, or warned
about. I read the data.table intro and the FAQ, and also ?setnames.
Ben Bolker created a minimal reproducible example:
library(data.table)
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
names(DT)
## [1] "x" "y" "v"
oldnames <- names(DT)
print(oldnames)
## [1] "x" "y" "v"
setnames(DT, LETTERS[1:3])
print(oldnames)
## [1] "A" "B" "C"
--
McMaster University Department of Biology
http://lalashan.mcmaster.ca/theobio/DushoffLab/index.php/Main_Page
https://twitter.com/jd_mathbio
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.