<div>
Not sure how to debug without being able to reproduce. Tried on Mac OS X 10.8.5 and Debian GNU/Linux 7 (wheezy). I don't have access to a windows machine. I consistently gives me this:</div><div><br></div><div><div>> dt[,</div><div>+ list(max=max(y, na.rm=TRUE)),</div><div>+ by=list(by)</div><div>+ ]</div><div> by max</div><div>1: 0.7 0.01464054</div><div>2: 0.4 0.87328871</div><div>> </div><div>> dt[,</div><div>+ list(max=max(y, na.rm=TRUE)),</div><div>+ by=list(by)</div><div>+ ]</div><div> by max</div><div>1: 0.7 0.01464054</div><div>2: 0.4 0.87328871</div></div><div><br></div><div>Can either of you provide me with the output of these steps in cases where there's an error? I've commented the output I get for each step. </div><div><br></div><div>byval <- list(by=dt$by) </div><div>o__ <- data.table:::fastorder(byval) # 2,3,1</div><div><div>f__ = data.table:::uniqlist(byval, order=o__) # 1,3</div><div>len__ = data.table:::uniqlengths(f__, nrow(dt)) # 2,1</div><div>firstofeachgroup = o__[f__] # 2,1</div><div>origorder = data.table:::iradixorder(firstofeachgroup) # 2,1</div><div>f__ = f__[origorder] # 3,1</div><div>len__ = len__[origorder] # 2,1</div></div><div><br></div><div><br></div><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" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<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>
</blockquote>
<div>
<br>
</div>