-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_file on empty file throws error #356
Comments
I see that most of the function is written in c, which I normally couldn't wrap my head around, but maybe simply checking filesize in plain R code would suffice to fix this? |
Slightly different case of #378. Need to think if |
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. |
|
I'd expect to get an empty string, but instead get:
Error: Cannot read file /tmp/RtmpFO5GFJ/file4dc73de7d6a2.txt
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)
My testcase:
The text was updated successfully, but these errors were encountered: