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

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

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

                                        Persons
                                         人

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

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

A class and utility methods for holding information about persons like name and email address.
如姓名和电子邮件地址的人的信息持有A类和实用的方法。


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


person(given = NULL, family = NULL, middle = NULL,
       email = NULL, role = NULL, comment = NULL,
       first = NULL, last = NULL)
## Default S3 method:[默认方法]
as.person(x)
## S3 method for class 'person'
format(x,
       include = c("given", "family", "email", "role", "comment"),
       braces = list(given = "", family = "", email = c("<", ">"),
                     role = c("[", "]"), comment = c("(", ")")),
       collapse = list(given = " ", family = " ", email = ", ",
                       role = ", ", comment = ", "),
       ...
       )



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

参数:given
a character vector with the given names, or a list thereof.
一个给定的名称,或列表及其特征向量。


参数:family
a character string with the family name, or a list thereof.
一个姓氏,或其中一个列表的字符串。


参数:middle
a character string with the collapsed middle name(s). Deprecated, see Details.
与倒塌的中间名(S)的字符串。已过时,请参阅详细信息。


参数:email
a character string giving the email address, or a list thereof.
字符串提供的电子邮件地址,或列表。


参数:role
a character string specifying the role of the person (see Details), or a list thereof.
字符串指定的人的作用(见详情),或列表。


参数:comment
a character string providing a comment, or a list thereof.
一个字符串,提供意见,或列表。


参数:first
a character string giving the first name. Deprecated, see Details.
一个字符串,给人的第一名称。已过时,请参阅详细信息。


参数:last
a character string giving the last name. Deprecated, see Details.
一个字符串,给人的姓。已过时,请参阅详细信息。


参数:x
a character string for the as.person default method; an object of class "person" otherwise.
as.person默认方法为字符串;类"person"否则的对象。


参数:include
a character vector giving the fields to be included when formatting.
给一个字符向量的领域,包括格式化时。


参数:braces
a list of characters (see Details).
一个字符列表(见详情)。


参数:collapse
a list of characters (see Details).
一个字符列表(见详情)。


参数:...
currently not used.   
目前没有使用。


Details

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

Objects of class "person" can hold information about an arbitrary positive number of persons.  These can be obtained by one call to person() with list arguments, or by first creating objects representing single persons and combining these via c().
"person"类的对象,可容纳约一个任意正数人的信息。这些都可以通过一个调用person()列表参数,或先创建对象,单身人士代表相结合,通过c()这些。

The format() method collapses information about persons into character vectors (one string for each person): the fields in include are selected, each collapsed to a string using the respective element of collapse and subsequently “embraced” using the respective element of braces, and finally collapsed into one string separated by white space.  If braces and/or collapse do not specify characters for all fields, the defaults shown in the usage are imputed.  The print() method calls the format() method and prints the result, the toBibtex() method creates a suitable BibTeX representation.
format()方法倒塌约成特征向量,每个人(一个字符串)的人的信息:在领域include选择,每个倒塌使用collapse“,随后的各元素的字符串“拥抱”利用各自的元素braces,终于坍塌成一个字符串由空格分隔。如果braces和/或collapse不指定字符的所有领域,在使用中的默认归咎于。 print()方法调用format()方法,并打印结果,toBibtex()方法创建一个合适的BibTEX表示。

Person objects can be subscripted by fields (using $) or by position (using [).
Person对象可以是字段下标(使用$)或位置(使用[)。

as.person() is a generic function.  Its default method tries to reverse the default person formatting, and can also handle formatted person entries collapsed by comma or "and" (with appropriate white space).
as.person()是一个通用的功能。其默认的方法,试图扭转默认人士格式,也可以格式化人昏倒逗号或"and"(用适当的空格)项处理。

Personal names are rather tricky, e.g., http://en.wikipedia.org/wiki/Personal_name.
个人的名字是相当棘手,例如,http://en.wikipedia.org/wiki/Personal_name。

The current implementation (starting from R 2.12.0) of the "person" class uses the notions of given (including middle names) and family names, as specified by given and family respectively.  Earlier versions used a scheme based on first, middle and last names, as appropriate for most of Western culture where the given name precedes the family name, but not universal, as some other cultures place it after the family name, or use no family name.  To smooth the transition to the new scheme, arguments first, middle and last are still supported, but their use is deprecated and they must not be given in combination with the corresponding new style arguments.
目前实施的"person"类(2.12.0从研发开始)(包括中间名)和家人的名字,given和family分别指定使用的概念。早期版本中使用的计划的基础上,中间和最后的名字,适合大多数西方文化在给定的名称之前的姓氏,但不是万能的,作为姓氏后放置一些其他文化,或不使用姓氏。顺利过渡到新的计划,论据first,middle和last仍然支持,但它们的使用已过时,他们不能给予相应的新的风格参数组合。

The new scheme also adds the possibility of specifying roles based on a subset of the MARC Value List for Relators and Roles (http://www.loc.gov/standards/sourcelist/relator-role.html). When giving the roles of persons in the context of authoring R packages, the following usage is suggested.
新计划还增加了指定上MARC值列表的叙述者和角色(http://www.loc.gov/standards/sourcelist/relator-role.html)的子集基于角色的可能性。创作R包中的人的角色时,建议使用以下。




"aut" (Author) Use for full authors who have made substantial contributions to the package and should show up in the
"aut"(作者)使用谁作出了重大贡献包,并应在充分作家




"com" (Compiler) Use for package maintainers who collected code (potentially in other languages) but did not make
"com"(编译器)使用包维护者收集代码(可能在其他语言),但并没有使




"ctb" (Contributor) Use for authors who have made smaller contributions (such as code patches etc.) but should not
"ctb"(贡献者)使用那些小的贡献(如代码补丁等),但不应作者




"cph" (Copyright holder) Use for all copyright holders.
"cph"(版权持有人)使用版权持有人所有。




"cre" (Creator) Use for the package maintainer.
"cre"(造物主)使用软件包的维护者。




"ths" (Thesis advisor) If the package is part of a
"ths"如果包的一部分(论文顾问)




"trl" (Translator) If the R code is a translation from
"trl"(翻译)如果R代码是从翻译

In the old scheme, person objects were used for single persons, and a separate "personList" class with corresponding creator personList() for collections of these.  The new scheme employs a single class for information about an arbitrary positive number of persons, eliminating the need for the personList mechanism.
在旧的计划,人的对象被用于单人,和一个单独的"personList"类相应的创造者personList()这些藏品。新的计划,雇用了约一个任意的正数为personList机制的需要,消除人的信息的单个类。


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

person() and as.person() return objects of class "person".
person()和as.person()类"person"返回的对象。


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


## Create a person object directly ...[#创建一个person对象直接...]
p1 <- person("Karl", "Pearson", email = "pearson@stats.heaven")

## ... or convert a string.[#...或转换成一个字符串。]
p2 <- as.person("Ronald Aylmer Fisher")

## Combining and subsetting.[#结合和子集。]
p <- c(p1, p2)
p[1]
p[-1]

## Extracting fields.[#提取领域。]
p$family
p$email
p[1]$email

## Specifying package authors, example from "boot":[#指定包的作者,从“引导”的例子:]
## AC is the first author [aut] who wrote the S original.[#AC是第一作者[引渡]是谁写的原始。]
## BR is the second author [aut], who translated the code to R [trl],[#BR是第二作者[引渡],谁翻译的代码为R [TRL]]
## and maintains the package [cre].[#和维护包[创建]。]
b <- c(person("Angelo", "Canty", role = "aut", comment =
         "S original, http://statwww.epfl.ch/davison/BMA/library.html"),
       person(c("Brian", "D."), "Ripley", role = c("aut", "trl", "cre"),
              comment = "R port", email = "ripley@stats.ox.ac.uk")
     )
b

## Formatting.[#格式化。]
format(b)
format(b, include = c("family", "given", "role"),
   braces = list(family = c("", ","), role = c("(Role(s): ", ")")))

## Conversion to BibTeX author field.[#转换的BibTEX作者字段。]
paste(format(b, include = c("given", "family")), collapse = " and ")
toBibtex(b)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-5 02:48 , Processed in 0.024401 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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