[datatable-help] R Studio Interactions with data.table
Shir Levkowitz
levkowitz at dc-energy.com
Tue Apr 22 20:23:10 CEST 2014
I have gotten a crash right off the bat in console R (3.0.2, data.table 1.9.2) on Linux,
*** caught segfault ***
address (nil), cause 'unknown'
Traceback:
1: `[.data.table`(dt, , `:=`(forward_date, c(rep(NA, 5), date)), by = "strip")
2: dt[, `:=`(forward_date, c(rep(NA, 5), date)), by = "strip"]
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 2
Save workspace image? [y/n/c]: n
Warning message:
In `[.data.table`(dt, , `:=`(forward_date, c(rep(NA, 5), date)), :
RHS 1 is length 15 (greater than the size (10) of group 1). The last 5 element(s) will be discarded.
It seems like this bug may be related, though three years old: https://r-forge.r-project.org/tracker/?group_id=240&atid=975&func=detail&aid=1664
Shir
On Apr 22, 2014, at 2:18 PM, Kevin Ushey <kevinushey at gmail.com> wrote:
> FWIW, I can reproduce this segfault within the console as well,
> including with the latest SVN version of data.table 1.9.3.
>
> Running under R -d lldb, I don't get a segfault off the bat; I get:
>
>> dt[,forward_date:=c(rep(NA,5),date),by='strip']
>
> Warning message:
>
> In `[.data.table`(dt, , `:=`(forward_date, c(rep(NA, 5), date)), :
> RHS 1 is length 15 (greater than the size (10) of group 1). The last
> 5 element(s) will be discarded.
>
> I also see the error, if I play around in the console a bit after launching R:
>
>> dt[,forward_date:=c(rep(NA,5),date),by='strip']
>
> Process 55776 stopped
>
> * thread #1: tid = 0x13b169, 0x000000010002bf60
> libR.dylib`Rf_copyMostAttrib(inp=0x0000000101bb0f50,
> ans=0x0000000101bb0ea8) + 192 at attrib.c:274, queue =
> 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
> address=0x417e)
>
> frame #0: 0x000000010002bf60
> libR.dylib`Rf_copyMostAttrib(inp=0x0000000101bb0f50,
> ans=0x0000000101bb0ea8) + 192 at attrib.c:274
> 271 PROTECT(ans);
> 272 PROTECT(inp);
> 273 for (s = ATTRIB(inp); s != R_NilValue; s = CDR(s)) {
> -> 274 if ((TAG(s) != R_NamesSymbol) &&
> 275 (TAG(s) != R_DimSymbol) &&
> 276 (TAG(s) != R_DimNamesSymbol)) {
> 277 installAttrib(ans, TAG(s), CAR(s));
>
> Hopefully this gives a starting point in debugging...
>
> Kevin
>
> On Tue, Apr 22, 2014 at 11:07 AM, Zachary Long <long at dc-energy.com> wrote:
>> Hello,
>>
>> I was wondering if an error like this had been addressed before. I am using
>> data table 1.9.2.
>>
>> It appears that the error has to do with the interaction with R-Studio. When
>> I run
>>
>> library(data.table)
>> dt<-data.table(strip="Nov08",date=c("2006-08-01","2006-08-02","2006-08-03","2006-08-04","2006-08-07",
>>
>> "2006-08-08","2006-08-09","2006-08-10","2006-08-11","2006-08-14"))
>> dt[,forward_date:=c(rep(NA,5),date),by='strip']
>>
>>
>> The result I expect is below, along with a warning message.
>>
>> strip date forward_date
>> 1: Nov08 2006-08-01 NA
>> 2: Nov08 2006-08-02 NA
>> 3: Nov08 2006-08-03 NA
>> 4: Nov08 2006-08-04 NA
>> 5: Nov08 2006-08-07 NA
>> 6: Nov08 2006-08-08 2006-08-01
>> 7: Nov08 2006-08-09 2006-08-02
>> 8: Nov08 2006-08-10 2006-08-03
>> 9: Nov08 2006-08-11 2006-08-04
>> 10: Nov08 2006-08-14 2006-08-07
>>
>>
>> However, I don't get this.
>>
>> 1 of two things can happen.
>>
>> 1. My R-Studio will completely crash without warning. All unsaved
>> information is lost.
>> 2. I can get "Error: Value of SET_STRING_ELT() must be a 'CHARSXP' not a
>> 'character'" "In addition:Lost warning messages"
>>
>> Do you know what is the cause here? It seems related to memory allocation,
>> or something under the hood relating to the interaction of R-Studio and data
>> table.
>>
>> Zach
>>
>> _______________________________________________
>> datatable-help mailing list
>> datatable-help at lists.r-forge.r-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
More information about the datatable-help
mailing list