<div>As I was just writing Kevin, I think (if @mnel could verify his output is correct), the reason is because Kevin's using R-devel...
</div>
<div><div><br></div><div>If you do the following shown below, then, `xx` should *not* have the same address as *dt$by* (as is the case for me). But for Kevin, they seem to be pointing to the same location and I can't figure out why it would/should, from how R has been working so far.</div><div><div>byval <- list(by=dt$by)</div><div>address(dt$by)</div><div># [1] "0x7fa848ad8608"</div><div><br></div><div>address(byval)</div><div># [1] "0x7fa84a93fa68"</div><div><br></div><div>xx = byval[[1L]]</div><div>address(xx)</div><div># [1] "0x7fa848e3fc48"</div><div><br></div><div>address(list(xx))</div><div>[1] "0x7fa84aa1ba78"</div><div><br></div><div>data.table:::dradixorder(xx)</div><div># [1] 2 3 1</div><div><br></div><div>byval</div><div>$by</div><div>[1] 0.7 0.4 0.4</div></div><div><br></div><div>Arun</div><div><br></div></div>
<p style="color: #A0A0A8;">On Thursday, December 19, 2013 at 9:36 AM, Arunkumar Srinivasan wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>
<div>@mnel, I'm not sure I understand your output. Yours is different from the correct output, but it is also different from Kevin's. Basically, dt[, max(y), by=by] has no effect on yours and just returns back dt?
</div>
<div><div><br></div><div>Arun</div><div><br></div></div>
<p style="color: #A0A0A8;">On Thursday, December 19, 2013 at 3:50 AM, Michael Nelson wrote:</p><blockquote type="cite"><div>
<span><div><div><div>Using</div><div>data.table 1.8.11 (Fresh install from r-forge today)</div><div>R version 3.0.2 (2013-09-25)</div><div>Platform: x86_64-w64-mingw32/x64 (64-bit)</div><div><br></div><div>I get</div><div><br></div><div> by max</div><div>1: 0.7 0.01464054</div><div>2: 0.4 0.87328871</div><div>3: 0.4 -1.02794620</div><div><br></div><div>On both runs.</div><div><br></div><div><br></div><div><br></div><div><br></div><div>________________________________________</div><div>From: <a href="mailto:datatable-help-bounces@lists.r-forge.r-project.org">datatable-help-bounces@lists.r-forge.r-project.org</a> [<a href="mailto:datatable-help-bounces@lists.r-forge.r-project.org">datatable-help-bounces@lists.r-forge.r-project.org</a>] on behalf of Kevin Ushey [<a href="mailto:kevinushey@gmail.com">kevinushey@gmail.com</a>]</div><div>Sent: Thursday, 19 December 2013 12:54 PM</div><div>To: <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div>Subject: [datatable-help] 'by' on a numeric column produces inconsistent output</div><div><br></div><div>I'm cross-posting this from the GitHub mirror:</div><div><a href="https://github.com/arunsrinivasan/datatable/issues/2">https://github.com/arunsrinivasan/datatable/issues/2</a></div><div><br></div><div>For reference, I only see this with the latest RForge version of</div><div>data.table (1.8.11), not the CRAN version of data.table.</div><div><br></div><div>-----</div><div><br></div><div>library(data.table, lib="/Users/kevinushey/Library/R/3.1/library")</div><div>set.seed(32)</div><div>n <- 3</div><div>dt <- data.table(</div><div> y=rnorm(n),</div><div> by=round( rnorm(n), 1)</div><div>)</div><div><br></div><div>dt[,</div><div> list(max=max(y, na.rm=TRUE)),</div><div> by=list(by)</div><div>]</div><div><br></div><div>dt[,</div><div> list(max=max(y, na.rm=TRUE)),</div><div> by=list(by)</div><div>]</div><div><br></div><div>produces the output</div><div><br></div><blockquote type="cite"><div>dt[,</div></blockquote><div>+ list(max=max(y, na.rm=TRUE)),</div><div>+ by=list(by)</div><div>+ ]</div><div> by max</div><div>1: 0.4 0.01464054</div><div>2: 0.4 0.87328871</div><div>3: 0.7 -1.02794620</div><blockquote type="cite"><div><div><br></div><div>dt[,</div></div></blockquote><div>+ list(max=max(y, na.rm=TRUE)),</div><div>+ by=list(by)</div><div>+ ]</div><div> by max</div><div>1: 0.4 0.8732887</div><div>2: 0.7 -1.0279462</div><div><br></div><div>For some reason, the first return is wrong, while the second (and all</div><div>subsequent) output is correct. Any idea what's going on?</div><div><br></div><blockquote type="cite"><div>sessionInfo()</div></blockquote><div>R Under development (unstable) (2013-12-12 r64453)</div><div>Platform: x86_64-apple-darwin13.0.0 (64-bit)</div><div><br></div><div>locale:</div><div>[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8</div><div><br></div><div>attached base packages:</div><div>[1] stats graphics grDevices utils datasets methods base</div><div><br></div><div>other attached packages:</div><div>[1] data.table_1.8.11 knitr_1.5 devtools_1.4.1.99</div><div>BiocInstaller_1.13.3</div><div><br></div><div>loaded via a namespace (and not attached):</div><div> [1] compiler_3.1.0 digest_0.6.4 evaluate_0.5.1 formatR_0.10</div><div>httr_0.2 memoise_0.1</div><div> [7] parallel_3.1.0 plyr_1.8 RCurl_1.95-4.1 reshape2_1.2.2</div><div>stringr_0.6.2 tools_3.1.0</div><div>[13] whisker_0.3-2</div><div><br></div><div>---</div><div><br></div><div>Kevin</div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></div></span>
</div></blockquote><div>
<br>
</div>
</div></div></span>
</blockquote>
<div>
<br>
</div>