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

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

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

                                        Documentation Shortcuts
                                         文件快捷方式

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

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

These functions provide access to documentation. Documentation on a topic with name name (typically, an R object or a data set) can be displayed by either help("name") or ?name.
这些功能提供了访问文档。一个主题文件名称为name(通常R对象或数据集),可以显示或者help("name")或?name。


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


?topic

type?topic



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

参数:topic
Usually, a name or character string specifying the topic for which help is sought.  Alternatively, a function call to ask for documentation on a corresponding S4 method: see the section on S4 method documentation. The calls <VAR>pkg</VAR>::<VAR>topic</VAR> and <VAR>pkg</VAR>:::<VAR>topic</VAR> are treated specially, and look for help on topic in package <VAR>pkg</VAR>.  
通常,一个名称或字符串指定其帮助主题的追捧。另外,一个函数调用文件中S4中相应的方法:问看到S4方法的文档部分。来电<VAR>pkg</VAR>::<VAR>topic</VAR>和<VAR>pkg</VAR>:::<VAR>topic</VAR>是特殊处理,并为包topic查找<VAR>pkg</VAR>帮助。


参数:type
the special type of documentation to use for this topic; for example, if the type is class, documentation is provided for the class with name topic. See the Section "S4 Method Documentation" for the uses of type to get help on formal methods, including methods?<VAR>function</VAR> and method?<VAR>call</VAR>.  
特殊类型的文件,使用此主题,例如,如果类型class,文档类的名称topic。 S4方法的文档“一节”的用途type得到正式的方法,包括methods?<VAR>function</VAR>和method?<VAR>call</VAR>帮助。


Details

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

This is a shortcut to help and uses its default type of help.
这是一个help的捷径,并使用其默认类型的帮助。

Some topics need to be quoted (by backticks) or given as a character string.  There include those which cannot syntactically appear on their own such as unary and binary operators, function and control-flow reserved words (including if, else for, in, repeat, while, break and next.  The other reserved words can be used as if they were names, for example TRUE, NA and Inf.
有些议题需要被引用(反引号)或字符串。包括语法不能对自己的出现,例如一元和二元运算符,function和控制流的保留字(包括if,elsefor,<X >,in,repeat,while和break。其他next的话可以使用,如果他们的名字,例如reserved ,TRUE和NA。


S4方法文档----------S4 Method Documentation----------

Authors of formal ("S4") methods can provide documentation on specific methods, as well as overall documentation on the methods of a particular function.  The "?" operator allows access to this documentation in three ways.
正式(“S4”)方法作者可以提供的具体方法,以及对某一特定功能的方法整体文件的文档。 "?"运营商可以在三种方式访问此文档。

The expression methods?<VAR>f</VAR> will look for the overall documentation methods for the function <VAR>f</VAR>.  Currently, this means the documentation file containing the alias <VAR>f</VAR>-methods.
methods?<VAR>f</VAR>将寻找整体功能<VAR>f</VAR>文件的方法。目前,这意味着文档文件包含别名<VAR>f</VAR>-methods。

There are two different ways to look for documentation on a particular method.  The first is to supply the topic argument in the form of a function call, omitting the type argument. The effect is to look for documentation on the method that would be used if this function call were actually evaluated. See the examples below.  If the function is not a generic (no S4 methods are defined for it), the help reverts to documentation on the function name.
文件寻找一个特定的方法有两种不同的方式。首先是在函数调用的形式提供的topic参数,省略了type参数。效果看,如果这个函数调用进行实际评估的方法,将用于文档。见下面的例子。如果不是一个普通的(没有的S4方法是为它定义)的功能是,帮助恢复文档的函数名。

The "?" operator can also be called with doc_type supplied as method; in this case also, the topic argument is a function call, but the arguments are now interpreted as specifying the class of the argument, not the actual expression that will appear in a real call to the function.  See the examples below.
"?"运营商也可以被称为doc_type提供method;在这种情况下,topic参数是一个函数调用,但现在解释为指定的参数类的说法,而不是实际的表达,将出现一个真正的函数调用。见下面的例子。

The first approach will be tedious if the actual call involves complicated expressions, and may be slow if the arguments take a long time to evaluate.  The second approach avoids these issues, but you do have to know what the classes of the actual arguments will be when they are evaluated.
第一种方法是将繁琐,如果实际通话涉及到复杂的表达式,并可能会很慢,如果参数需要很长的时间来评估。第二种方法避免了这些问题,但你要知道什么实际参数的类时,他们会评估。

Both approaches make use of any inherited methods; the signature of the method to be looked up is found by using selectMethod (see the documentation for getMethod).
两种方法使用任何继承的方法;方法签名要抬起头来使用selectMethod(看到getMethod的文档)。


参考文献----------References----------

The New S Language. Wadsworth &amp; Brooks/Cole.

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

help
help

?? for finding help pages on a vague topic.
??帮助页面上找到一个模糊的主题。


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


?lapply

?"for"                  # but quotes/backticks are needed[但需要报价/反引号]
?`+`

?women                  # information about data set "women"[有关数据信息设置“妇女”]

## Not run: [#无法运行:]
require(methods)
## define a S4 generic function and some methods[#定义中S4中的通用功能和一些方法。]
combo <- function(x, y) c(x, y)
setGeneric("combo")
setMethod("combo", c("numeric", "numeric"), function(x, y) x+y)

## assume we have written some documentation[#假定我们已经写了一些文件]
## for combo, and its methods ....[#的组合,其方法....]

?combo  # produces the function documentation[生产函数的文档]

methods?combo  # looks for the overall methods documentation[看起来文档的整体方法]

method?combo("numeric", "numeric")  # documentation for the method above[上述方法的文档]

?combo(1:10, rnorm(10))  # ... the same method, selected according to[...同样的方法,根据选择]
                         # the arguments (one integer, the other numeric)[论点(一个整数,其他数字)]

?combo(1:10, letters)    # documentation for the default method[文件的默认方法]


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 01:30 , Processed in 0.021172 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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