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

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

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

                                        Data Sets
                                         数据集

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

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

Loads specified data sets, or list the available data sets.
加载指定数据集,或列出可用的数据集。


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


data(..., list = character(), package = NULL, lib.loc = NULL,
     verbose = getOption("verbose"), envir = .GlobalEnv)



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

参数:...
a sequence of names or literal character strings.
名称或文字字符串序列。


参数:list
a character vector.
字符向量。


参数:package
a character vector giving the package(s) to look in for data sets, or NULL.  By default, all packages in the search path are used, then the "data" subdirectory (if present) of the current working directory.  
字符向量包(S)看,在数据集,或NULL。默认情况下,用于在搜索路径中的所有包,然后data子目录中的当前工作目录(如果存在)。


参数:lib.loc
a character vector of directory names of R libraries, or NULL.  The default value of NULL corresponds to all libraries currently known.
特征向量的研发图书馆的目录名,或NULL。默认值的NULL对应于目前已知的所有库。


参数:verbose
a logical.  If TRUE, additional diagnostics are printed.
一个逻辑。如果TRUE,印有额外的诊断。


参数:envir
the environment where the data should be loaded.
应的数据加载的环境。


Details

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

Currently, four formats of data files are supported:
目前,4个数据文件格式的支持:

files ending ".R" or ".r" are source()d in, with the R working directory changed temporarily to the directory containing the respective file. (data ensures that the utils package is attached, in case it had been run via utils::data.)
文件结束.R或.rsource()D与R的工作目录改变暂时的目录包含各自的文件。 (data确保utils包安装的情况下,它已通过utils::data运行。)

files ending ".RData" or ".rda" are load()ed.
文件结束.RData或.rdaload()版。

files ending ".tab", ".txt" or ".TXT" are read using read.table(..., header = TRUE), and hence result in a data frame.
文件结束.tab,.txt或.TXT使用read.table(..., header = TRUE),从而导致数据框。

files ending ".csv" or ".CSV" are read using read.table(..., header = TRUE, sep = ";"), and also result in a data frame.
文件结束.csv或.CSV使用read.table(..., header = TRUE, sep = ";"),也导致数据框读。

If more than one matching file name is found, the first on this list is used.  (Files with extensions ".txt", ".tab" or ".csv" can be compressed, with or without further extension ".gz", ".bz2" or ".xz".)
如果发现多个匹配文件名,这个名单上首次使用。 (文件扩展“.txt,.tab或.csv可以被压缩,有或没有进一步扩大.gz&rsquo ;,.bz2或.xz)

The data sets to be loaded can be specified as a sequence of names or character strings, or as the character vector list, or as both.
可以作为一个名称或字符串序列指定要加载的数据集,或作为特征向量list,或两者。

For each given data set, the first two types (".R" or ".r", and ".RData" or ".rda" files) can create several variables in the load environment, which might all be named differently from the data set.  The third and fourth types will always result in the creation of a single variable with the same name (without extension) as the data set.
对于每一个给定的数据集,前两种类型(.R或.r,.RData或.rda&rsquo ;文件)可以创建几个变量,负载环境中,这可能会被命名为不同的数据集。第三和第四类型总是会导致在创建一个数据集具有相同的名称(不含扩展名)的单变量。

If no data sets are specified, data lists the available data sets.  It looks for a new-style data index in the "Meta" or, if this is not found, an old-style "00Index" file in the "data" directory of each specified package, and uses these files to prepare a listing.  If there is a "data" area but no index, available data files for loading are computed and included in the listing, and a warning is given: such packages are incomplete.  The information about available data sets is returned in an object of class "packageIQR".  The structure of this class is experimental. Where the datasets have a different name from the argument that should be used to retrieve them the index will have an entry like beaver1 (beavers) which tells us that dataset beaver1 can be retrieved by the call data(beaver).
如果没有指定数据集,data列出了可用的数据集。它看起来在Meta,或者如果没有发现这是一个旧式“00Index文件在data为一个新的风格的数据指数指定的每个包的目录,并使用这些文件的准备上市。如果有一个data区域,但没有索引,可装载数据文件计算和上市,并给出了一个警告:这样的包是不完整的。有关可用的数据集的信息中返回一个对象类"packageIQR"。这个类的结构是实验。凡集从参数应该用来检索他们的指数将有一个像beaver1 (beavers)它告诉我们,集beaver1可以通过调用data(beaver)检索条目有一个不同的名字 。

If lib.loc and package are both NULL (the default), the data sets are searched for in all the currently loaded packages then in the "data" directory (if any) of the current working directory.
如果lib.loc和package都NULL(默认),数据集搜索在所有当前加载的包,然后在“data目录(如果任何当前的工作目录)。

If lib.loc = NULL but package is specified as a character vector, the specified package(s) are searched for first amongst loaded packages and then in the default library/ies (see .libPaths).
如果lib.loc = NULL但是package被指定作为一个特征向量,指定包(S)搜索第一之间装包,然后在默认库/ IES(见.libPaths)。

If lib.loc is specified (and not NULL), packages are searched for in the specified library/ies, even if they are already loaded from another library.
如果lib.loc(非NULL),包搜索在指定库/ IES,即使他们已经从另一个库加载。

To just look in the "data" directory of the current working directory, set package = character(0) (and lib.loc =     NULL, the default).
刚才看在data在当前工作目录的目录,设置package = character(0)(lib.loc =     NULL,默认)。


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

A character vector of all data sets specified, or information about all available data sets in an object of class "packageIQR" if none were specified.
设置指定的所有数据的特征向量,或在一个类的对象的所有可用的数据信息设置"packageIQR"如果没有指定。


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

The data files can be many small files.  On some file systems it is desirable to save space, and the files in the "data" directory of an installed package can be zipped up as a zip archive "Rdata.zip".  You will need to provide a single-column file "filelist" of file names in that directory.
数据文件可以是许多小文件。在一些文件系统,这是可取的,以节省空间,并在“data可安装的软件包目录压缩为一个zip档案Rdata.zip的文件。您将需要提供单列文件filelist在该目录中的文件名。

One can take advantage of the search order and the fact that a ".R" file will change directory.  If raw data are stored in "mydata.txt" then one can set up "mydata.R" to read "mydata.txt" and pre-process it, e.g., using transform. For instance one can convert numeric vectors to factors with the appropriate labels.  Thus, the ".R" file can effectively contain a metadata specification for the plaintext formats.
一个可以利用的搜索顺序的优势,其实“.R文件将改变目录。如果原始数据存储mydata.txt然后可以设立mydata.R改为mydata.txt和预过程,例如,使用 transform。例如,可以适当的标签转换的数值向量的因素。因此,.R文件,可以有效地遏制了明文格式的元数据规范。


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

help for obtaining documentation on data sets, save for creating the second (".rda") kind of data, typically the most efficient one.
help获取数据文件的设置,save创建第二个(.rda)的数据,通常是最有效的一个样。

The "Writing R Extensions" for considerations in preparing the "data" directory of a package.
写R扩展“的考虑,在准备了一个包data目录。


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


require(utils)
data()                       # list all available data sets[列出所有可用的数据集]
try(data(package = "rpart") )# list the data sets in the rpart package[列出在软件rpart包的数据集]
data(USArrests, "VADeaths")  # load the data sets 'USArrests' and 'VADeaths'[加载数据集USArrests和VADeaths“]
help(USArrests)              # give information on data set 'USArrests'[给数据集“USArrests信息]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 06:21 , Processed in 0.021219 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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