[R] Segmentation fault with data.frame

Sean Davis sdavis2 at mail.nih.gov
Thu Jan 1 19:59:28 CET 2004


All,

I have some code that I have been working on that crashes R (1.8.1 on MacOS
X installed from source).  Here are excerpts of the code and data
structures.  When the lists that I am using to construct the data.frame are
truncated (shortened), R catches the differing rows and warns.  However,
when the entire lists are used (I haven't looked for an exact breakpoint or
for a particular list value), segmentation fault occurs.  I suppose that I
could send individuals the data if that would help.

Thanks,
Sean
-- 
Sean Davis, M.D., Ph.D.
Clinical Fellow
Combined Pediatric Hematology/Oncology Fellowship
Johns Hopkins/National Institutes of Health
NHGRI/NCI
--



> str(b[1:20])
List of 20
 $ cHsKG501A10: chr "2"
 $ cHsKG501A11: NULL
 $ cHsKG501A12: chr "2"
 $ cHsKG501A2 : chr "16"
 $ cHsKG501A3 : chr "1"
 $ cHsKG501A4 : chr "19"
 $ cHsKG501A5 : chr "3"
 $ cHsKG501A6 : chr "2"
 $ cHsKG501A7 : chr "8"
 $ cHsKG501A8 : chr "7"
 $ cHsKG501A9 : NULL
 $ cHsKG501B1 : chr "17"
 $ cHsKG501B10: chr "5"
 $ cHsKG501B11: chr "X"
 $ cHsKG501B12: chr "9"
 $ cHsKG501B2 : chr "19"
 $ cHsKG501B3 : chr "16"
 $ cHsKG501B4 : chr "1"
 $ cHsKG501B5 : NULL
 $ cHsKG501B6 : chr "10"
> str(c[1:20])
 Named num [1:20]  1.20e+08        NA  9.79e+07 -4.99e+06 -1.53e+08 ...
 - attr(*, "names")= chr [1:20] "cHsKG501A10" "cHsKG501A11" "cHsKG501A12"
"cHsKG501A2" ...
> str(a[1:20])
List of 20
 $ cHsKG501A10: Named num 1.20e+08
  ..- attr(*, "names")= chr "2"
 $ cHsKG501A11: logi NA
 $ cHsKG501A12: Named num 97883920
  ..- attr(*, "names")= chr "2"
 $ cHsKG501A2 : Named num -4987429
  ..- attr(*, "names")= chr "16"
 $ cHsKG501A3 : Named num -1.53e+08
  ..- attr(*, "names")= chr "1"
 $ cHsKG501A4 : Named num 45948618
  ..- attr(*, "names")= chr "19"
 $ cHsKG501A5 : Named num 44876718
  ..- attr(*, "names")= chr "3"
 $ cHsKG501A6 : Named num -55212004
  ..- attr(*, "names")= chr "2"
 $ cHsKG501A7 : Named num 3.8e+07
  ..- attr(*, "names")= chr "8"
 $ cHsKG501A8 : Named num -99310824
  ..- attr(*, "names")= chr "7"
 $ cHsKG501A9 : logi NA
 $ cHsKG501B1 : Named num 38671548
  ..- attr(*, "names")= chr "17"
 $ cHsKG501B10: Named num -1.69e+08
  ..- attr(*, "names")= chr "5"
 $ cHsKG501B11: Named num 1.46e+08
  ..- attr(*, "names")= chr "X"
 $ cHsKG501B12: Named num 4975244
  ..- attr(*, "names")= chr "9"
 $ cHsKG501B2 : Named num -52426291
  ..- attr(*, "names")= chr "19"
 $ cHsKG501B3 : Named num -30493284
  ..- attr(*, "names")= chr "16"
 $ cHsKG501B4 : Named num -16827011
  ..- attr(*, "names")= chr "1"
 $ cHsKG501B5 : logi NA
 $ cHsKG501B6 : Named num -71546026
  ..- attr(*, "names")= chr "10"
> d <- a[1:20]
> e <- b[1:20]
> f <- c[1:20]
> df <- data.frame(t1=d,t2=e,t3=f)
Error in data.frame(cHsKG501A10 = "2", cHsKG501A11 = NULL, cHsKG501A12 =
"2",  : 
    arguments imply differing number of rows: 1, 0
> length(a)
[1] 11039
> length(b)
[1] 11039
> length(c)
[1] 11039
> d <- a[1:11039]
> e <- b[1:11039]
> f <- c[1:11039]
> df <- data.frame(t1=d,t2=e,t3=f)

Process R segmentation fault at Thu Jan  1 13:45:55 2004




More information about the R-help mailing list