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())
FALSE
(default), only visible
files are considered; if TRUE
, all files are used."code"
(R code), "data"
(data
sets), "demo"
(demos), "docs"
(R documentation), and
"vignette"
(vignettes)..Platform$OS.type
, is used.file_ext
returns the file (name) extensions (excluding the
leading dot).
(Only purely alphanumeric extensions are recognized.) file_path_as_absolute
turns a possibly relative file path
absolute, performing tilde expansion if necessary. This is a wrapper
for normalizePath
. Currently, x
must be a single
existing path.
file_path_sans_ext
returns the file paths without extensions
(and the leading dot).
(Only purely alphanumeric extensions are recognized.)
list_files_with_exts
returns the paths or names of the files in
directory dir
with extension matching one of the elements of
exts
. Note that by default, full paths are returned, and that
only visible files are used.
list_files_with_type
returns the paths of the files in dir
of the given OS_subdirs
. Note that by default, full paths are
returned, and that only visible files are used.
file.path
,
file.info
,
list.files
dir <- file.path(R.home(), "library", "stats")
list_files_with_exts(file.path(dir, "demo"), "R")
list_files_with_type(file.path(dir, "demo"), "demo") # the same
file_path_sans_ext(list.files(file.path(R.home("modules"))))
Run the code above in your browser using DataLab