找回密码
 注册
查看: 2682|回复: 0

R语言:files()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 17:42:14 | 显示全部楼层 |阅读模式
files(base)
files()所属R语言包:base

                                        File Manipulation
                                         文件操作

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

These functions provide a low-level interface to the computer's file system.
这些功能提供了一个低级别的计算机的文件系统接口。


用法----------Usage----------


file.create(..., showWarnings = TRUE)
file.exists(...)
file.remove(...)
file.rename(from, to)
file.append(file1, file2)
file.copy(from, to, overwrite = recursive, recursive = FALSE,
          copy.mode = TRUE)
file.symlink(from, to)
file.link(from, to)



参数----------Arguments----------

参数:..., file1, file2
character vectors, containing file names or paths.
特征向量,包含文件名或路径。


参数:from, to
character vectors, containing file names or paths. For file.copy and file.symlink to can alternatively be the path to a single existing directory.
特征向量,包含文件名或路径。 file.copy和file.symlinkto也可以是一个单一的现有目录的路径。


参数:overwrite
logical; should existing destination files be overwritten?
逻辑;应该已存在的目的地文件被覆盖?


参数:showWarnings
logical; should the warnings on failure be shown?
逻辑;应显示失败的警告?


参数:recursive
logical.  If to is a directory, should directories in from be copied (and their contents)?
逻辑。 to如果是一个目录,目录中的from被复制(和其内容)?


参数:copy.mode
logical:  should file permission bits be copied where possible?  This applies to both files and directories.
逻辑:文件权限位被复制在可能的情况下?这适用于这两个文件和目录。


Details

详情----------Details----------

The ... arguments are concatenated to form one character string: you can specify the files separately or as one vector. All of these functions expand path names: see path.expand.
...参数连接起来,形成一个字符串:你可以指定文件单独或作为一个向量。所有这些功能的拓展路径名:见path.expand。

file.create creates files with the given names if they do not already exist and truncates them if they do.  They are created with the maximal read/write permissions allowed by the "umask" setting (where relevant).  By default a warning is given (with the reason) if the operation fails.
file.create给定的名称创建文件,如果他们不存在,截断他们如果他们这样做。他们创建的最大“的umask设置(如适用)允许读/写权限。默认情况下发出警告(如果操作失败的原因)。

file.exists returns a logical vector indicating whether the files named by its argument exist.  (Here "exists" is in the sense of the system's stat call: a file will be reported as existing only if you have the permissions needed by stat. Existence can also be checked by file.access, which might use different permissions and so obtain a different result. Note that the existence of a file does not imply that it is readable: for that use file.access.)  What constitutes a "file" is system-dependent, but should include directories. (However, directory names must not include a trailing backslash or slash on Windows.)  Note that if the file is a symbolic link on a Unix-alike, the result indicates if the link points to an actual file, not just if the link exists.
file.exists返回一个逻辑向量,说明其参数命名的文件是否存在。 (这里“存在”是:在系统的stat呼叫感。文件将作为现有的唯一的,如果你有stat所需的权限的存在,也可以由<X检查报告>,这可能会使用不同的权限,并因此获得不同的结果说明,该文件的存在并不意味着它是可读。file.access)什么构成了“文件”,使用的是系统依赖,但应包括目录。 (但是,目录名必须不包括尾部的反斜杠或Windows上的削减。)请注意,如果该文件是一个符号链接在Unix相似,结果表明,如果链接指向一个实际的文件,不只是如果链接存在。

file.remove attempts to remove the files named in its argument. On most Unix platforms "file" includes empty directories, symbolic links, fifos and sockets.  On Windows, "file" means a regular file and not, say, an empty directory.
file.remove尝试删除其参数命名的文件。在大多数Unix平台的文件,包括空目录,符号链接,FIFO的和插座。在Windows中,“文件”是指一个普通的文件,而不是说,一个空目录。

file.rename attempts to rename files (and from and to must be of the same length).  Where file permissions allow this will overwrite an existing element of to.  This is subject to the limitations of the OS's corresponding system call (see something like man 2 rename on a Unix-alike): in particular in the interpretation of "file": most platforms will not rename files across file systems.  (On Windows, file.rename nowadays works for files (but not directories) across volumes.)
file.rename试图重命名文件(from和to必须是相同的长度)。在文件权限允许,这将覆盖现有的元素to。这是受到操作系统的相应的系统调用(见像man 2 rename在Unix相似的东西):特别是在“文件”的解释:大多数平台上,将不会重命名文件跨文件系统的限制。 (在Windows,file.rename时下工作。跨卷的文件(而不是目录))

file.append attempts to append the files named by its second argument to those named by its first.  The R subscript recycling rule is used to align names given in vectors of different lengths.
file.append尝试追加命名它的第二个参数首次命名的文件。用于调整不同长度的向量名的R标回收规则。

file.copy works in a similar way to file.append but with the arguments in the natural order for copying.  Copying to existing destination files is skipped unless overwrite = TRUE.  The to argument can specify a single existing directory.  If copy.mode = TRUE (added in R 2.13.0) file read/write/execute permissions are copied where possible, restricted by "umask".  Other security attributes such as ACLs are not copied.
file.copy工作,以类似的方式file.append但在复制的自然秩序的论据。除非overwrite = TRUE复制到现有的目标文件被跳过。 to参数,可以指定一个单一的现有目录。如果copy.mode = TRUE(在2.13.0&#341;添加)文件读/写/执行权限被复制在可能的情况下,限制的umask。如ACL等安全属性不会被复制。

file.symlink and file.link make symbolic and hard links on those file systems which support them.  For file.symlink the to argument can specify a single existing directory.  (Unix and Mac OS X native filesystems support both.  Windows has hard links on NTFS file systems.  What happens on a FAT or SMB-mounted file system is OS-specific.)
file.symlink和file.link让那些支持他们的文件系统上的符号和硬链接。 file.symlinkto参数,可以指定一个单一的现有目录。 (Unix和Mac OS X本地文件系统的支持。Windows的NTFS文件系统的硬链接。在FAT或SMB挂载的文件系统会发生什么事情是特定于操作系统的。)


值----------Value----------

These functions return a logical vector indicating which operation succeeded for each of the files attempted.  Using a missing value for a file or path name will always be regarded as a failure.
这些函数返回一个逻辑向量的操作成功地为每个试图文件。使用的文件或路径名的遗漏值将永远被视为失败。

If showWarnings = TRUE, file.create will give a warning for an unexpected failure.
如果showWarnings = TRUE,file.create会给一个意外故障的警告。


注意----------Note----------

There is no guarantee that these functions will handle Windows relative paths of the form "d:path": try "d:./path" instead.  In particular, "d:" is not recognized as a directory. Nor are \\?\ prefixes (and similar) supported.
谁也不能保证,这些功能将处理相对路径形式d:path的的Windows:尝试d:./path代替。特别是,d:不是一个目录确认。也不是\\?\前缀(以及类似)支持。

Recent versions of Windows have a limited version of symbolic links on NTFS filesystems, but this has not be implemented in file.symlink, not least because R is still widely used on Windows XP.
最新版本的Windows有一个有限的NTFS文件系统的符号链接的版本,但是这并没有实施file.symlink,而不是因为R仍然广泛使用的Windows XP。

Most of these functions accept UTF-8 filepaths not valid in the current locale.
这些功能中的大多数不接受UTF-8文件路径在当前语言环境的有效。

User error in supplying invalid file names (and note that "foo/" is invalid on Windows) has undefined consequences.
用户提供无效的文件名称错误(注意,foo/Windows上是无效的)有未定义的后果。


作者(S)----------Author(s)----------



Ross Ihaka, Brian Ripley




参见----------See Also----------

file.info, file.access, file.path, file.show, list.files, unlink, basename, path.expand.
file.info,file.access,file.path,file.show,list.files,unlink,basename,path.expand。

dir.create.
dir.create。

Sys.glob to expand wildcards in file specifications.
Sys.glob扩大通配符文件规范。

file_test, Sys.readlink.
file_test,Sys.readlink。

http://en.wikipedia.org/wiki/Hard_link and http://en.wikipedia.org/wiki/Symbolic_link for the concepts of links and their limitations.
http://en.wikipedia.org/wiki/Hard_link和http://en.wikipedia.org/wiki/Symbolic_link链接的概念及其局限性。


举例----------Examples----------


cat("file A\n", file="A")
cat("file B\n", file="B")
file.append("A", "B")
file.create("A")
file.append("A", rep("B", 10))
if(interactive()) file.show("A")
file.copy("A", "C")
dir.create("tmp")
file.copy(c("A", "B"), "tmp")
list.files("tmp")
unlink("tmp", recursive=TRUE)
file.remove("A", "B", "C")

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 05:57 , Processed in 0.026066 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表