[Rd] R can't source() long lines (PR#10383)

martin.kober at gmail.com martin.kober at gmail.com
Tue Oct 30 02:00:07 CET 2007


Full_Name: Martin Kober
Version: 2.6.0
OS: Vista & Linux
Submission from: (NULL) (137.208.185.169)


Hi!

I just stumbled upon a problem with file source()ing:

R will fail to source a file if it contains lines longer than about 8192 bytes
("input buffer overflow").

While it's save to say that human-written code won't contain lines that long,
dump()ed data structures may reasonably contain strings longer than that (as in
my case).

What's more, R will happily help you to create such files:

x = paste(rep("12345678", 1024), collapse="")
dump("x")
source("dumpdata.R") ## this fails (on Linux & Vista)

I'm now using save/load, which is probably better in that case anyway. Still, I
would be nice if source() worked or at least dump() would break lines to avoid
this issue.

Best regards,
Martin Kober



More information about the R-devel mailing list