The read_delim function accepts literal data when the file argument contains a newline, however, it will still attempt to access a file whose name is the literal data. This is because read_delimited will call empty_file on the literal data, which will (on Linux) end up calling the stat syscall.
Easily reproduced with:
[bash] strace -e trace=stat R
[r] library ('readr')
[r] read_delim ('this\nshould\nnot\nhappen', delim = ',')
[console] stat("this\nshould\nnot\nhappen", 0x7ffd6298e220) = -1 ENOENT (No such file or directory)
The function works in that it then correctly parses the literal data, but it is still strange that it should use the literal data to access the file system. (In general, it feels like doing autodetect on the file argument rather than distinguishing files, links and literal data through different arguments is somewhat fragile, and perhaps even not very useful.)
The
read_delimfunction accepts literal data when thefileargument contains a newline, however, it will still attempt to access a file whose name is the literal data. This is becauseread_delimitedwill callempty_fileon the literal data, which will (on Linux) end up calling thestatsyscall.Easily reproduced with:
The function works in that it then correctly parses the literal data, but it is still strange that it should use the literal data to access the file system. (In general, it feels like doing autodetect on the
fileargument rather than distinguishing files, links and literal data through different arguments is somewhat fragile, and perhaps even not very useful.)