Description Usage Arguments Details Value Author(s) Examples
Check whether files exist (or don't exist), and stop()
1 |
... |
files to check |
invert |
check for existence of a file, instead of non-existence |
I often want to run a script only if a particular file or files already exist. Or perhaps only run a script if the output file doesn't already exist. To avoid writing a lot of =if(file.exists(f)) = this is a convenience function.
no return value
Chris Wallace
1 2 3 4 5 6 | ## Should do nothing
checkfile(system.file(c("INDEX","help")))
checkfile(system.file(c("ThisFileShouldNotExist")),invert=TRUE)
## Should call stop()
checkfile(system.file(c("INDEX","help")),invert=TRUE)
checkfile(system.file(c("ThisFileShouldNotExist")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.