Skip to content
Prev 41349 / 63421 Next

load.R patch suggestion

> Inspired by

    > http://stackoverflow.com/questions/7487778/could-you-tell-me-what-this-error-means

    > I wrote the following very small (one-line) patch which
    > returns an *informative* error message when R tries to
    > load a zero-byte file rather than

    > Error in if (!grepl("RD[AX]2\n", magic)) { : argument is
    > of length zero

    >   I would guess that error messages with the word "magic"
    > in them would be disturbing to new users, who are probably
    > worried already that R is magic ...

:-)  indeed...

While it would not be a good idea to program around such error
messages in general, as each extra if(...) is executed everytime
the function is called, i.e. has a (albeit *very small*) penalty for
every correct call just for the sake of that message in the
erronous call case,
I do agree that it is worth here and so have added it (for
R-devel only).

Thank you, Ben.

    >   Ben Bolker