[datatable-help] Problem with keys when by= generates NAs

Matthew Dowle mdowle at mdowle.plus.com
Sat Oct 22 00:31:47 CEST 2011


Thanks I see that too. So that's how the invalid keys can arise! Bit
trickier this one, please could you raise a
    bug.report(package="data.table")
so it doesn't get forgotten.

On Fri, 2011-10-21 at 12:49 -0700, Muhammad Waliji wrote:
> The following warning occurs in both versions 1.6.6 and 1.7.1.  I
> haven't tried other versions.
> 
> 
> > DT <- data.table(var1=rep(c(1, 2), each=5),
> +                  var2=seq(0, 1, length.out=10),
> +                  key="var1")
> > DT.2 <- DT[, list(sum(var2)), list(ifelse(var1 == 1, 1, NA))]
> > setkey(DT.2, var1)
> Warning message:
> In setkey(DT.2, var1) :
>   Already keyed by this key but had invalid row order, key rebuilt. If
> you didn't go under the hood please let maintainer('data.table') know
> so the root cause can be fixed.
> 
> 
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help




More information about the datatable-help mailing list