/usr/share/doc/r-cran-r.utils/tests/findFiles.R is in r-cran-r.utils 2.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | message("Testing findFiles()...")
library("R.utils")
path <- system.file(".", package="R.utils")
pathname <- findFiles(paths=path, firstOnly=TRUE)
print(pathname)
pathnames <- findFiles(paths=path, firstOnly=FALSE)
str(pathnames)
pathnames <- findFiles(paths=path, recursive=TRUE, firstOnly=FALSE)
str(pathnames)
pathnames <- findFiles(pattern="[.]rds$", paths=path, recursive=TRUE, firstOnly=FALSE)
str(pathnames)
## Recursive searching
pathnames0 <- findFiles(paths=path, recursive=FALSE, firstOnly=FALSE)
str(pathnames)
pathnames <- findFiles(paths=path, recursive=0L, firstOnly=FALSE)
str(pathnames)
stopifnot(identical(pathnames, pathnames0))
pathnamesInf <- findFiles(paths=path, recursive=TRUE, firstOnly=FALSE)
str(pathnamesInf)
stopifnot(length(pathnamesInf) >= length(pathnames0))
pathnames <- findFiles(paths=path, recursive=+Inf, firstOnly=FALSE)
str(pathnames)
stopifnot(identical(pathnames, pathnamesInf))
pathnames2 <- findFiles(paths=path, recursive=2L, firstOnly=FALSE)
str(pathnames2)
stopifnot(length(pathnames2) >= length(pathnames0))
stopifnot(length(pathnames2) <= length(pathnamesInf))
message("Testing findFiles()...DONE")
|