file_ext(x) file_path_as_absolute(x) file_path_sans_ext(x, compression = FALSE) list_files_with_exts(dir, exts, all.files = FALSE, full.names = TRUE) list_files_with_type(dir, type, all.files = FALSE, full.names = TRUE, OS_subdirs = .OStype())
x | a character vector specifying the file names or paths. For file_path_as_absolute, only single string is supported at present. |
compression | a logical value. If TRUE, the extensions "gz", "bz2" and "xz" will be trimmed before checking extensions. |
dir | a character vector specifying the file directories. |
exts | a character vector specifying the file extensions. |
all.files | a logical value. If FALSE(the default), only visible (non-hidden) file or directory names are returned. Otherwise, the entire contents of directory are returned. (Hidden files or directories are those with names that begin with a period.) |
full.names | a logical value. If TRUE(the default), the directory path is prepended to the returned names. Otherwise, only the file or directory name is in the return value. |
type | a character string specifying the file type. The supported file type could be code("code"), data("data"), demo("demo"), documentations("docs") and vignette("vignette"). See details as below. |
OS_subdirs | a character string specifying the OS-specific subdirectories when listing code and documentation files. See details as below. |
type | extensions |
"code" | "R", "r", "S", "s", "q" |
"data" | "R", "r", "RData", "rdata", "rda", "tab", "txt", "TXT", "tab.gz", "txt.gz", "tab.bz2", "txt.bz2", "tab.xz", "txt.xz", "csv", "CSV", "csv.gz", "csv.bz2", "csv.xz" |
"demo" | "R", "r" |
"docs" | "Rd", "rd", "Rd.gz", "rd.gz" |
"vignette" | "Rnw", "rnw", "Snw", "snw", "Rtex","rtex", "Stex", "stex", "Rmd" |
file_ext(c("fileA.txt", "fileB.png", "DESCRIPTION")) file_path_sans_ext(c("fileC.csv", "fileD.csv.gz")) file_path_sans_ext(c("fileC.csv", "fileD.csv.gz"), compress=TRUE) ## Not run: file_path_as_absolute(".") list_files_with_exts(R.home("share/doc/html"), ext="css") list_files_with_type(R.home("etc"), type="code") ## End(Not run)