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:
f <- tempfile( fileext=".txt" )
cat( "", file=f )
expect_true( file.exists(f) )
expect_that(
read.file( f ),
is_identical_to( "" )
)
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: