Bug 15300 - factors with incorrect structure sent to `write.table` cause crash on Ubuntu, OSX and other systems
factors with incorrect structure sent to `write.table` cause crash on Ubuntu,...
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Low-level
R 3.0.0
All All
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-30 15:15 UTC by Ricardo Saporta
Modified: 2013-05-02 18:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo Saporta 2013-04-30 15:15:09 UTC
Brief Description:
  Calling write.table on a data.frame with factors with atypical structure causes crash. 

EXAMPLE: 

    PROBLEM_DATA <- structure(114:116, .Label = c("String1", "String2", "String3", "String4", "String5", "String6", "String7", "String8", "String9", "String10", "String11", "String12", "String13", "String14", "String15"), class = "factor")


   # This will cause a crash
   write.table(PROBLEM_DATA, file=path.expand("~/test.csv"))


Further Discussion on Stack Overflow: 

     http://stackoverflow.com/questions/15816532/crashing-r-when-calling-write-table-on-particular-data-set?noredirect=1#comment23337562_15816532
Comment 1 Duncan Murdoch 2013-05-02 18:27:49 UTC
I will fix write.table for now, but perhaps the error should have occurred when the bad factor was created.