Yes this isn't a data.table criticism, just a bit64 one in general.<br><br><div>On Wed Feb 12 2014 at 11:39:47 AM, Matt Dowle <<a href="mailto:mdowle@mdowle.plus.com">mdowle@mdowle.plus.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div><br>
Sometimes we take the hard road in data.table, to get to a better
place. Once bit64::integer64 is fully supported, it'll be much
easier. All the recent radix work for double applies almost
automatically to integer64 for example, but that radix work had
to be done first.</div></div><div bgcolor="#FFFFFF" text="#000000"><div><br>
<br>
On 12/02/14 16:26, <a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a> wrote:<br>
</div></div><div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite">FYI (and this is a long outstanding argument) this is
why I don't like the bit64 package. These sorts of errors happen
silently. I understand that data.table can't use the other
integer64 package, but at least there it is obvious when things
are being coerced. <br>
<div><br>
</div>
<div>In my situations, if I am grouping by a int64, it is usually
either an ID so I can just make it a character vector instead,
or it is something where I don't mind lost precision so I just
make it numeric. </div>
<br>
<div>On Wed Feb 12 2014 at 11:22:40 AM, Matt Dowle <<a href="mailto:mdowle@mdowle.plus.com" target="_blank">mdowle@mdowle.plus.com</a>>
wrote:</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi,<br>
<br>
You're doing nothing wrong. Although you can load integer64
using fread<br>
and create them directly, data.table's grouping and keys don't
work on<br>
them yet. Sorry, just not yet implemented. Because integer64
are<br>
internally stored as type double (a good idea by package
bit64),<br>
data.table sees them internally as double and doesn't catch that
the<br>
type isn't supported yet (hence no error message such as you get
for<br>
type 'complex'). The particular integer64 numbers in this
example are<br>
quite small so will use the lower bits. In double, those are
the most<br>
precise part of the significand, which would explain why only
one group<br>
comes out here since data.table groups and joins floating point
data<br>
within tolerance.<br>
<br>
Matt<br>
<br>
On 06/02/14 23:38, Yike Lu wrote:<br>
> After a long hiatus, I am back to using data.table.
Unfortunately,<br>
> I've encountered a problem. Am I doing something wrong
here?<br>
><br>
> require(data.table)<br>
><br>
> dt = data.table(idx = 1:100 %% 3, 1:100)<br>
> dt[, list(sum(V2)), by = idx]<br>
> # normal<br>
><br>
> require(bit64)<br>
><br>
> dt2 = data.table(idx = integer64(100) + 1:100 %% 3, 1:100)<br>
> dt2[, list(sum(V2)), by = idx]<br>
> # only has one group:<br>
> # idx V1<br>
> #1: 1 5050<br>
><br>
<br>
_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
</blockquote>
</blockquote>
<br>
</div></blockquote>