I expect DT2 <- unique.data.frame(DT1) to be a new object, but get a
warning about pointers, so apparently it is not...?

A short example:

DT1 <- data.table(1)
DT2 <- unique.data.frame(DT1)
DT2[,gah:=1]


An example closer to my application, undoing a cartesian/cross join:

DT1 <- CJ(A=0:1,B=1:6,D0=0:1,D=0:1)[D>=D0]
setkey(DT1,A)
DT2 <- unique.data.frame(DT1[,-which(names(DT1)%in%'B'),with=FALSE])
DT2[,gah:=1] # warning: I should have made a copy, apparently


I'm fine with explicitly making a copy, of course, and don't really know
anything about pointers. I just thought I'd bring it up.

--Frank
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to