Hi all,

On Wed, Jul 31, 2013 at 9:09 AM, Arunkumar Srinivasan
<[email protected]> wrote:
> Ricardo,
>
> You read my mind.. :) I was thinking of the same as well.. Whether the
> community agrees or not would be interesting as well. It could save trouble
> with "alloc.col" manually.

It's easy enough to add -- just to be sure, the behavior required from
the OP would be equivalent to calling unique on a data.table that has
no key, right? For example, instead of this:

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

You could just do:

R> DT1 <- CJ(A=0:1,B=1:6,D0=0:1,D=0:1)[D>=D0]
R> DT2 <- unique(DT1[, -which(names(DT1)%in%'B'), with=FALSE])
R> DT2[,gah:=1]

Right?

-steve

-- 
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to