During my workflow I often make a copy of main data.frame/data.table that I do some aspects of the work on and then some other on the other copy, before joining them or something later on. However, I often experience that these copies are still connected to each other. So that edits done on one are also done on the other.Unfortunately I am not able to replicate it, but copy-pasting from my console it looks something like this:
# 'used3' is a copy of 'used' with some altercations to it
c("nLocs","nDays") %in% names(used)
[1] FALSE FALSE
> used3[, nDays :=uniqueN(yDay),c("ID","Year","Season")]
> used3[, nLocs :=.N,c("ID","Year","Season")]
> c("nLocs","nDays") %in% names(used)
[1] TRUE TRUE
So that alterations done on the copy are allso done on the original. Is this a bug? Am I calling them too similar names...or what?
R-version: 3.3 data.table version: 1.9.6
But also experienced in older versions of both R and data.table