<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">There's also a[["x"]], I suppose... :)</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
and, looking at methods(`[`) ...</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">`[.listof`(a,1)</div><div style="font-family:arial,sans-serif;font-size:13px">
`[.data.frame`(a,1)<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">if it's in the 1st column.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Because we can't fully see your example, maybe you'll want to look at these other segfault stories: <a href="http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D" target="_blank">http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D</a> I think they're both fixed with the latest R and data.table, though.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">--Frank</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
p.s. Sorry for the double reply, Chris; forgot to use "reply to all"</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 1:59 PM, Frank Erickson <span dir="ltr"><<a href="mailto:FErickson@psu.edu" target="_blank">FErickson@psu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There's also a[["x"]], I suppose... :)<div><br></div><div>and, looking at methods(`[`) ...</div>
<div><br></div><div>`[.listof`(a,1)</div><div>`[.data.frame`(a,1)<br></div><div><br></div><div>if it's in the 1st column.</div>
<div><br></div><div>Because we can't fully see your example, maybe you'll want to look at these other segfault stories: <a href="http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D" target="_blank">http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D</a> I think they're both fixed with the latest R and data.table, though.</div>
<div><br></div><div>--Frank</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Sep 10, 2013 at 1:47 PM, Chris Neff <span dir="ltr"><<a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Narrowing it down further, <div><br></div><div>a$x</div><div><br></div>
<div>segfaults and</div><div><br>
</div><div>a[,x]</div><div><br></div><div>segfaults but</div><div><br></div><div>a[,"x", with=FALSE]</div>
<div><br></div><div>doesn't.</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 1:32 PM, Chris Neff <span dir="ltr"><<a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm pretty sure it is some issue of a column that thinks it is bigger than it actually is. I have tried, so far in vain, to make a reproducible example that I can share. I have one, but can't share it.<div>
<br></div><div>What happens is this: </div><div><br></div><div>A data.frame is made:</div><div><br></div><div>> d = data.frame(...)</div><div><br></div><div>Then I call apply over every row, calling a different function that takes in a DT as well:</div>
<div><br></div><div>l = apply(d, 1, function(x) func(x[1], x[2], DT))</div><div><br></div><div>This returns a data.frame. If I rbindlist this:</div><div><br></div><div>a = rbindlist(l)</div><div><br></div><div>I can print a just fine, and it will show me all data like normal. but if I try to just do </div>
<div><br></div><div>a$x</div><div><br></div><div>x is one of the columns that was a key in DT, then it segfaults. If I ask for a column that was made by "func" and wasn't a column in DT, it works fine. If I ask for only the first 10 rows and then ask for x:</div>
<div><br></div><div>a[1:10]$x</div><div><br></div><div>it works fine.</div><div><br></div><div>So somewhere these key columns think they are different lengths than they really are, and when I try to access it I go into memory I shouldn't so I segfault. How can I verify this? Is there something about the DT I can check to see what DT thinks these columns are?</div>
<div><br></div><div><br></div><div>Also, if instead of apply when making the list, I do</div><div><br></div><div>l = lapply(1:nrow(d), function(i) func(x[i,1],x[i,2],DT))</div><div><br></div><div>and rbindlist that, it works fine too.<br>
<br></div></div>
</blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<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></div><br></div>
</blockquote></div><br></div>