You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
We usually assume that the name() function returns a character vector instead of the memory reference. However with the operator := it seems that the n becomes the memory reference. Do you think it is necessary not to return the reference?
a <- data.table(a=seq(10), b=seq(10))
> n<-names(a)
[1] "a" "b"
> a[,c:=seq(10)]
> n # we expect n is just a vector.
[1] "a" "b" "c"
Activity
DavidArenburg commentedon Aug 24, 2016
See this http://stackoverflow.com/questions/15913417/why-does-data-table-update-namesdt-by-reference-even-if-i-assign-to-another-v
jangorecki commentedon Aug 24, 2016
Hi, this is documented in
?copy, link provided by David is also good references about that behavior.