<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
Nothing springs to mind. Latest version v1.8.10 from CRAN right?
Or v1.8.11 on R-Forge?<br>
<br>
On this bit :<br>
> So somewhere these key columns think they are different
lengths than they really are, and<br>
> when I try to access it I go into memory I shouldn't so I
segfault. How can I verify this? Is<br>
> there something about the DT I can check to see what DT
thinks these columns are?<br>
<br>
.Internal(inspect(DT)) reveals the internal structure including
length and truelength on the column pointer vector as well as each
column.<br>
<br>
But it's a really odd way of using data.table. Iterating by row
is going to kill performance; data.table likes by column.<br>
<br>
If it really has to be by row then DT[, fun(.SD,...),
by=1:nrow(DT)] should be better than apply().<br>
<br>
Matthew<br>
<br>
On 10/09/13 18:47, Chris Neff wrote:<br>
</div>
<blockquote
cite="mid:CAAuY0RV7LQHY2E6KQLZif-3-euvojL+VWYYAQGrr08Bn+35b4A@mail.gmail.com"
type="cite">
<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 class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Sep 10, 2013 at 1:32 PM, Chris
Neff <span dir="ltr"><<a moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
datatable-help mailing list
<a class="moz-txt-link-abbreviated" href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" 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></pre>
</blockquote>
<br>
</body>
</html>