Description Usage Arguments Value Author(s) See Also Examples
Looks for a file named 'fn' in 'dir', and if not found there, broadens the search to the list or vector of directorys, 'dirs'. Returns TRUE or FALSE as to whether the file exists.
1 |
fn |
name of the file to search for |
dir |
the first directory to look in (expected location) |
dirs |
vector/list, a set of directories to look in should the file not be found in 'dir'. |
combine |
if a list is given, test whether ALL files valid |
logical vector of whether each file was found, or if combine is true, then a single value whether ALL valid or not.
Nicholas Cooper nick.cooper@cimr.cam.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 | orig.dir <- getwd(); setwd(tempdir()); # move to temporary dir
l.fn <- "temp.txt"
writeLines("test",con=l.fn)
some.local.files <- narm(list.files()[1:10])
print(some.local.files)
is.file(l.fn)
is.file(l.fn,dir=getwd())
is.file(some.local.files)
# add a non-valid file to the list to see what happens
is.file(c(some.local.files,"fakefile.unreal"))
is.file(c(some.local.files,"fakefile.unreal"),combine=FALSE)
unlink(l.fn)
setwd(orig.dir) # reset working dir to original
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.