There's also a[["x"]], I suppose... :) and, looking at methods(`[`) ...
`[.listof`(a,1) `[.data.frame`(a,1) if it's in the 1st column. Because we can't fully see your example, maybe you'll want to look at these other segfault stories: http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D I think they're both fixed with the latest R and data.table, though. --Frank p.s. Sorry for the double reply, Chris; forgot to use "reply to all" On Tue, Sep 10, 2013 at 1:59 PM, Frank Erickson <[email protected]> wrote: > There's also a[["x"]], I suppose... :) > > and, looking at methods(`[`) ... > > `[.listof`(a,1) > `[.data.frame`(a,1) > > if it's in the 1st column. > > Because we can't fully see your example, maybe you'll want to look at > these other segfault stories: > http://stackoverflow.com/search?q=segfault+%5Bdata.table%5D I think > they're both fixed with the latest R and data.table, though. > > --Frank > > > > On Tue, Sep 10, 2013 at 1:47 PM, Chris Neff <[email protected]> wrote: > >> Narrowing it down further, >> >> a$x >> >> segfaults and >> >> a[,x] >> >> segfaults but >> >> a[,"x", with=FALSE] >> >> doesn't. >> >> >> On Tue, Sep 10, 2013 at 1:32 PM, Chris Neff <[email protected]> wrote: >> >>> 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. >>> >>> What happens is this: >>> >>> A data.frame is made: >>> >>> > d = data.frame(...) >>> >>> Then I call apply over every row, calling a different function that >>> takes in a DT as well: >>> >>> l = apply(d, 1, function(x) func(x[1], x[2], DT)) >>> >>> This returns a data.frame. If I rbindlist this: >>> >>> a = rbindlist(l) >>> >>> I can print a just fine, and it will show me all data like normal. but >>> if I try to just do >>> >>> a$x >>> >>> 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: >>> >>> a[1:10]$x >>> >>> it works fine. >>> >>> 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? >>> >>> >>> Also, if instead of apply when making the list, I do >>> >>> l = lapply(1:nrow(d), function(i) func(x[i,1],x[i,2],DT)) >>> >>> and rbindlist that, it works fine too. >>> >>> >> >> _______________________________________________ >> datatable-help mailing list >> [email protected] >> >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help >> > >
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
