fileutils(tools)
fileutils()所属R语言包:tools
File Utilities
文件工具
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Utilities for listing files, and manipulating file paths.
公用事业的上市文件,操作文件路径。
用法----------Usage----------
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())
参数----------Arguments----------
参数:x
character vector giving file paths.
特征向量文件路径。
参数:compression
logical: should compression extension ".gz", ".bz2" or ".xz" be removed first?
逻辑:应压缩扩展.gz,.bz2或.xz第一个被删除?
参数:dir
a character string with the path name to a directory.
一个目录的路径名的字符串。
参数:exts
a character vector of possible file extensions.
一个可能的文件扩展名的字符向量。
参数:all.files
a logical. If FALSE (default), only visible files are considered; if TRUE, all files are used.
一个逻辑。如果FALSE(默认),文件被认为是唯一可见的,如果TRUE,所有文件都使用。
参数:full.names
a logical indicating whether the full paths of the files found are returned (default), or just the file names.
逻辑是否返回找到的文件的完整路径(默认),或只是文件名。
参数:type
a character string giving the "type" of the files to be listed, as characterized by their extensions. Currently, possible values are "code" (R code), "data" (data sets), "demo" (demos), "docs" (R documentation), and "vignette" (vignettes).
给文件的“类型”字符串上市,其扩展的特点。目前,可能的值是"code"(R代码),"data"(数据集),"demo"(演示),"docs"(注册商标的文件),和"vignette" (护身符)。
参数:OS_subdirs
a character vector with the names of OS-specific subdirectories to possibly include in the listing of R code and documentation files. By default, the value of the environment variable R_OSTYPE, or if this is empty, the value of .Platform$OS.type, is used.
特征向量与OS特定的子目录的名称可能包括在R代码和文档文件的列表。默认情况下,环境变量的值R_OSTYPE,或者如果这是空的,.Platform$OS.type价值,使用。
Details
详情----------Details----------
file_ext returns the file (name) extensions. (Only purely alphanumeric extensions are recognized.)
file_ext返回的文件(名称)的扩展。 (只有纯字母扩展的认可。)
file_path_as_absolute turns a possibly relative file path absolute, performing tilde expansion if necessary. As from R 2.13.0 this is a wrapper for normalizePath. Currently, x must be a single existing path.
file_path_as_absolute变成可能相对文件的绝对路径,如有必要执行波浪线扩张。从R 2.13.0是一个normalizePath的包装。目前,x必须是一个单一的现有路径。
file_path_sans_ext returns the file paths without extensions. (Only purely alphanumeric extensions are recognized.)
file_path_sans_ext返回不带扩展名的文件路径。 (只有纯字母扩展的认可。)
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_exts返回目录中的文件路径或名称dir扩展匹配exts的元素之一。请注意,默认情况下,返回完整的路径,只有可见的文件。
list_files_with_type returns the paths of the files in dir of the given "type", as determined by the extensions recognized by R. When listing R code and documentation files, files in OS-specific subdirectories are included if present according to the value of OS_subdirs. Note that by default, full paths are returned, and that only visible files are used.
list_files_with_typedir给定的“类型”,确定由R.承认的扩展,当R代码和文档文件,文件列出在OS特定的子目录包括返回的文件的路径如果根据目前的OS_subdirs值。请注意,默认情况下,返回完整的路径,只有可见的文件。
参见----------See Also----------
file.path, file.info, list.files
file.path,file.info,list.files
举例----------Examples----------
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"))))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|