checkFilePath {wrMisc} | R Documentation |
Check If File Is Available For Reading
Description
This function allows tesing if a given file-name corresponds to an existing file (eg for reading lateron). Indications to the path and file-extensions may be given separately. If no files do match .gz compressed versions may be searced, too.
Usage
checkFilePath(
fileName,
path,
expectExt = "",
mode = "byFile",
compressedOption = NULL,
strictExtension = NULL,
stopIfNothing = NULL,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
Arguments
fileName |
(character) name of file to be tested; may also include an absolute or relative path;
if |
path |
(character, length=1) optional separate entry for path of |
expectExt |
(character) file extension (will not be considered if |
mode |
(character) further details if function should give error or warning if no files found
integrates previous argument |
compressedOption |
deprected (logical) also look for .gz compressed files |
strictExtension |
deprected (logical) decide if extesion ( |
stopIfNothing |
deprected, please use argument |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allow easier tracking of messages produced |
Details
When the filename given by the user exists but it's file-extension is not matching expectExt
the argument strictExtension
allows to decide if the filename will still be returned or not.
When expectExt
is given, initial search will look for perfect matches.
However, if nothing is found and strictExtension=FALSE
, a more relaxed and non-case-sensitive search will be performed.
Value
This function returns a character vector with verified path and file-name(s), returns NULL
if nothing
See Also
Examples
(RhomeFi <- list.files(R.home()))
file.exists(file.path(R.home(), "bin"))
checkFilePath(c("xxx","unins000"), R.home(), expectExt="dat")