checkFiles {mmstat4} | R Documentation |
Checks whether all specified files are valid R or Python files
Description
checkFiles
checks whether all specified files are valid source files that can be executed
independently of each other. If an error occurs then:
If
open
is a function name or a function with afile
parameter, thencheckFiles
will try to open the faulty source file, otherwise not.The execution of
checkFiles
is stopped.
If you do not want the faulty source file to be opened immediately, use open=0
.
Three modes are available for checking a file
:
-
exist
: Does the source file exist? -
parse
: (default) isparse(file)
orpython -m "file"
successful? -
run
: isRscript "file"
orpython "file"
successful?
If source files has side effects, e.g. generating an image or some other output, and mode=="parse"
then
this will done during the check.
Usage
checkFiles(
files,
index = seq_along(files),
path = NULL,
open = openFile,
mode = c("parse", "run", "exist"),
...
)
Rsolo(
files,
index = seq_along(files),
path = NULL,
open = openFile,
mode = c("parse", "run", "exist"),
...
)
Arguments
files |
character: file name(s) |
index |
integer(s): if |
path |
character: path to start from (default: |
open |
function: function or function name to call after an error occurs (default: |
mode |
character which check to do |
... |
further parameters given to the function in |
Value
nothing
Examples
if (interactive()) {
files <- list.files(pattern="*.(R|py)$", full.names=TRUE, recursive=TRUE)
checkFiles(files)
}