[datatable-help] Copy on assign broken in some cases

Muhammad Waliji mhwaliji at google.com
Thu Oct 27 20:46:57 CEST 2011


I think this is a bug.  DT.2 <- DT.1 doesn't seem to make a copy in all
cases.

> DT.1 <- data.table(x=1, y=1)
> DT.2 <- DT.1
>
> # Both DT.1 and DT.2 are changed.
> DT.2[, y := NULL]
     x
[1,] 1
> DT.1
     x
[1,] 1
> DT.2
     x
[1,] 1
>
> # Only DT.2 is changed
> DT.2[, y := x]
     x y
[1,] 1 1
> DT.1
     x
[1,] 1
> DT.2
     x y
[1,] 1 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20111027/2fbb3c99/attachment.htm>


More information about the datatable-help mailing list