Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
read_file on empty file throws error #356
I'd expect to get an empty string, but instead get:
This could be what you designed it to do, but its arguably not what most users would expect from this function, and it should at least be documented (and tested for)
I believe that would be to overcomplicate things.
read_csv implies interpretation and perhaps a format (ie a csv table), read_file does not (not in the name at least).
.. and also not in the manual page, as it simply says:
"" or character() seems like the obvious result of reading an empty file, and the error reserved from when the file does not exist or otherwise cannot be read.
In the bigger scheme of things, something in the Rniverse should be able to read a file into a string. This is a natural thing to do, all the other cool scripting languages on the block have this. readr::read_file seems like the perfect fit, I (from my point of view) see no reason why its other friends in the readr package should impose roles on it.