<div>
Chris,
</div><div>It's not filed as a FR, IIRC. It's filed under "Internals".</div>
<div><div><br></div><div>Arun</div><div><br></div></div>
<p style="color: #A0A0A8;">On Wednesday, September 11, 2013 at 11:31 AM, Chris Neff wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div dir="ltr">Yes, dropping names altogether in data.table would fix this, and would be the cleanest thing overall since as is said in that thread data.table doesn't really work with rownames in mind anyway.<div><br></div>
<div>Except it is less of a FR now and more of a bad bug because you can get segfaults from it.</div></div><div><br><br><div>On Wed, Sep 11, 2013 at 5:24 AM, Arunkumar Srinivasan <span dir="ltr"><<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>></span> wrote:<br><blockquote type="cite"><div>
<div>
Most likely, <a href="https://r-forge.r-project.org/tracker/index.php?func=detail&aid=4882&group_id=240&atid=5335" target="_blank">this</a>, when fixed, will take care of it?
</div>
<div><div><br></div><div>Arun</div><div><br></div></div><div><div>
<p style="color:#a0a0a8">On Wednesday, September 11, 2013 at 11:17 AM, Chris Neff wrote:</p>
</div></div><blockquote type="cite"><div>
<span><div><div><div><div><div dir="ltr">Indeed, it shows that k1 and k2 both have names of length 2, and both times the value of names is just the variable names.<div><br></div><div>Where the names are getting added is by apply. What the issue with data.table is that it does not ignore names from short variables. I now have a small reproducible example I can share:</div>
<div><br></div><div>d <- data.frame(x=1:5)</div><div><br></div><div>f <- function(x) {data.table(x=x, y=1:10)}</div><div><br></div><div>l <- apply(d, 1, f)</div><div><br></div><div>lapply(l, function(x) lapply(x, names)) # All values of x have a name</div>
<div><br></div><div>a <- rbindlist(l) # a$x will segfault after this</div><div><br></div><div><br></div><div>The underlying issue is what data.table and data.frame do with rownames and recycling. Look at this simple case:</div>
<div><br></div><div>x <- 1:5</div><div>names(x) <- letters[1:5]</div><div><br></div><div>df <- data.frame(x=x, y=1:10) </div><div>#Warning message:</div><div># In data.frame(x = x, y = 1:10) :</div><div># row names were found from a short variable and have been discarded</div>
<div><br></div><div>lapply(df, names) # no names</div><div><br></div><div>dt <- data.table(x=x, y=1:1) # No warning</div><div><br></div><div>lapply(dt, names) # x has names, and they get recycled.</div><div><br></div>
<div>
<br></div><div>So data.table needs to follow data.frame logic for discarding row names when they would otherwise be recycled. </div><div><br></div><div><br></div><div>Bug submitted here: <a href="https://r-forge.r-project.org/tracker/index.php?func=detail&aid=4890&group_id=240&atid=975" target="_blank">https://r-forge.r-project.org/tracker/index.php?func=detail&aid=4890&group_id=240&atid=975<br>
</a></div><div>I'm surprised this has never arisen before, it seems like something that has been around forever.</div></div>
</div></div></div><div><div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">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" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></div></div></span>
</div></blockquote><div>
<br>
</div>
</div></blockquote></div><br></div>
</div></div></span>
</blockquote>
<div>
<br>
</div>