[R] Confusing behaviour in data.table: unexpectedly changing variable
Jonathan Dushoff
dushoff at mcmaster.ca
Wed Sep 25 15:10:35 CEST 2013
Thanks for your help, and sorry for mis-posting.
JD
On Wed, Sep 25, 2013 at 3:18 AM, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
> Very sorry to hear this bit you. If you need a copy of names before
> changing them by reference :
> oldnames <- copy(names(DT))
> This will be documented and it's on the bug list to do so. copy is needed in
> other circumstances too, see ?copy.
> More details here :
> http://stackoverflow.com/questions/18662715/colnames-being-dropped-in-data-table-in-r
> http://stackoverflow.com/questions/15913417/why-does-data-table-update-namesdt-by-reference-even-if-i-assign-to-another-v
More information about the R-help
mailing list