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

Muhammad Waliji mhwaliji at google.com
Sat Oct 22 01:32:28 CEST 2011


Filed bug 1631.

On Fri, Oct 21, 2011 at 3:31 PM, Matthew Dowle <mdowle at mdowle.plus.com>wrote:

> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20111021/2bd3987c/attachment.htm>


More information about the datatable-help mailing list