Useful test related to files
is.dir(path)is.writeable(path)
is.readable(path)
has_extension(path, ext)
a file path to examine
extension to test for (has_extension
only)
# NOT RUN {
see_if(is.dir(1))
tmp <- tempfile()
see_if(file.exists(tmp))
see_if(is.dir(tmp))
writeLines("x", tmp)
see_if(file.exists(tmp))
see_if(is.dir(tmp))
see_if(is.writeable(tmp))
see_if(is.readable(tmp))
unlink(tmp)
see_if(is.readable(tmp))
# }
Run the code above in your browser using DataLab