<div dir="ltr">Dear list,<div><br></div><div>I have a data.table object for instance DT:</div><div><br></div><div>x <- seq(1:100)</div><div>y <- x^2</div><div>DT <- data.table(X=x, Y=y)</div><div><br></div><div>and I produce a copy</div>
<div><br></div><div>DT2 <- DT</div><div><br></div><div>which I rename</div><div><br></div><div>setnames(DT2, c("A","B"))</div><div><br></div><div>this somehow also renames DT, the names of which are now "A" and "B".</div>
<div><br></div><div>How can I just rename the copy and keep the names of the original?</div><div><br></div><div>Many thanks,</div><div>Manabu<br clear="all"><div><br></div>-- <br><div dir="ltr">Manabu Sakamoto, PhD<div><a href="mailto:manabu.sakamoto@gmail.com" target="_blank">manabu.sakamoto@gmail.com</a></div>
</div>
</div></div>