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

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

[复制链接]
发表于 2012-2-16 21:05:46 | 显示全部楼层 |阅读模式
help.search(utils)
help.search()所属R语言包:utils

                                        Search the Help System
                                         搜索帮助系统

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

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

Allows for searching the help system for documentation matching a given character string in the (file) name, alias, title, concept or keyword entries (or any combination thereof), using either fuzzy matching or regular expression matching.  Names and titles of the matched help entries are displayed nicely formatted.
允许寻找匹配一个给定的字符串的文件(档案)名称,别名,标题,概念或关键字条目(或其任何组合)的帮助系统,使用或者模糊匹配或正则表达式匹配。匹配的帮助条目的名称和标题显示很好的格式化。

Vignette names, titles and keywords and demo names and titles may also be searched.
小品文的名称,标题和关键字和演示的姓名和头衔,也可能被搜查。


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


help.search(pattern, fields = c("alias", "concept", "title"),
            apropos, keyword, whatis, ignore.case = TRUE,
            package = NULL, lib.loc = NULL,
            help.db = getOption("help.db"),
            verbose = getOption("verbose"),
            rebuild = FALSE, agrep = NULL, use_UTF8 = FALSE,
            types = getOption("help.search.types"))
??pattern
field??pattern



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

参数:pattern
a character string to be matched in the specified fields.  If this is given, the arguments apropos, keyword, and whatis are ignored.
必须在指定的字段匹配的字符串。如果给出这个参数apropos,keyword,whatis被忽略。


参数:fields
a character vector specifying the fields of the help database to be searched.  The entries must be abbreviations of "name", "title", "alias", "concept", and "keyword", corresponding to the help page's (file) name, its title, the topics and concepts it provides documentation for, and the keywords it can be classified to.  See below for how vignettes and demos are searched.
字符向量的帮助数据库,指定要搜索的字段。参赛作品必须是"name","title","alias","concept","keyword",相应的帮助页面(文件)的名称,其名称,缩写的主题和概念,它提供的文档,关键字,它可分为。看到下面的护身符和演示如何搜索。


参数:apropos
a character string to be matched in the help page topics and title.
在帮助页面的主题和标题匹配一个字符串。


参数:keyword
a character string to be matched in the help page "keywords". "Keywords" are really categories: the standard categories are listed in file "R.home(&quot;doc&quot;)/KEYWORDS" (see also the example) and some package writers have defined their own.  If keyword is specified, agrep defaults to FALSE.   <tr valign="top"><td>whatis</td>
在帮助页面中的关键字“匹配一个字符串。 “关键字”是真正的类别:标准类别中列出文件R.home(&quot;doc&quot;)/KEYWORDS(见示例)和一些包作家定义自己。如果keyword指定agrep默认FALSE。 <tr valign=&quot;top&quot;> <TD>whatis</ TD>

a character string to be matched in the help page topics.
在帮助页面主题要匹配的字符串。


参数:ignore.case
a logical.  If TRUE, case is ignored during matching; if FALSE, pattern matching is case sensitive.
一个逻辑。如果TRUE,情况过程中忽略匹配;如果FALSE,模式匹配是大小写敏感的。


参数:package
a character vector with the names of packages to search through, or NULL in which case all available packages in the library trees specified by lib.loc are searched.
与特征向量的套件名称进行搜索,或NULL在这种情况下,在所有lib.loc指定的库树可用的软件包搜索。


参数:lib.loc
a character vector describing the location of R library trees to search through, or NULL.  The default value of NULL corresponds to all libraries currently known.
字符向量描述R库树的位置,通过搜索,或NULL。默认值的NULL对应于目前已知的所有库。


参数:help.db
a character string giving the file path to a previously built and saved help database, or NULL.
以前建成并保存的帮助数据库提供的文件路径字符串,或NULL。


参数:verbose
logical; if TRUE, the search process is traced. Integer values are also accepted, with TRUE being equivalent to 2, and 1 being less verbose.  On Windows a progress bar is shown during rebuilding, and on Unix a heartbeat is shown for verbose = 1 and a package-by-package list for verbose >= 2.
逻辑,如果TRUE,搜索过程跟踪。整数值也是可以接受的,用TRUE相当于2的,1是那么详细的。在重建过程中,一个进度条显示在Windows和Unix上的心跳显示verbose = 1和verbose >= 2包包列表。


参数:rebuild
a logical indicating whether the help database should be rebuilt.  This will be done automatically if lib.loc or the search path is changed, or if package is used and a value is not found.
逻辑指示是否应重建的帮助数据库。这将自动完成,如果lib.loc或改变搜索路径,或如果package使用一个值没有找到。


参数:agrep
if NULL (the default unless keyword is used) and the character string to be matched consists of alphanumeric characters, whitespace or a dash only, approximate (fuzzy) matching via agrep is used unless the string has fewer than 5 characters; otherwise, it is taken to contain a regular expression to be matched via grep.  If FALSE, approximate matching is not used.  Otherwise, one can give a numeric or a list specifying the maximal distance for the approximate match, see argument max.distance in the documentation for agrep.
如果NULL(除非keyword使用默认)字符串匹配包含字母数字字符,空格或破折号,近似的(模糊)匹配通过agrep使用,除非字符串少于5个字符,否则,它包含一个正则表达式,可以通过grep匹配。如果FALSE,不使用近似匹配。否则,你可以给一个数值或指定的最大距离为近似匹配的列表,请参见参数max.distance文件agrep。


参数:use_UTF8
logical: should be results be given in UTF-8 encoding? Also changes the meaning of regexps in agrep to be Perl regexps.
逻辑:应该是在UTF-8编码的结果呢?也改变了对正则表达式agrep是Perl的正则表达式的含义。


参数:types
a character vector listing the types of documentation to search.  The entries must be abbreviations of "vignette" "help" or "demo". Results will be presented in the  order specified.
字符向量列出的文件类型进行搜索。参赛作品必须是缩写"vignette""help"或"demo"。结果将提交在指定的顺序。


参数:field
a single value of fields to search.
了fields单值搜索。


Details

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

Upon installation of a package, a pre-built help.search index is serialized as "hsearch.rds" in the "Meta" directory (provided the package has any help pages).  Vignettes are also  indexed in the "Meta/vignette.rds" file.  These files are used to create the help search database.
当安装一个包,预先内置help.search指数序列的hsearch.rds中的Meta目录(包有任何帮助页面)。护身符也Meta/vignette.rds文件索引。这些文件被用来创建帮助搜索数据库。

The arguments apropos and whatis play a role similar to the Unix commands with the same names.
论据apropos和whatis发挥作用类似于具有相同名称的Unix命令。

Searching with agrep = FALSE will be several times faster than the default (once the database is built).  However, as from R 2.10.0 approximate searches should be fast enough (around a second with 2000 packages installed).
搜索以agrep = FALSE会比默认(一旦建立数据库)快好几倍。然而,从R 2.10.0近似搜索应该是足够快(约第二次与2000包安装)。

If possible, the help database is saved in memory for use by subsequent calls in the session.
如果可能的话,帮助数据库被保存在内存中在会议的后续调用使用。

Note that currently the aliases in the matching help files are not displayed.
请注意,目前不显示匹配的帮助文件中的别名。

As with ?, in ?? the pattern may be prefixed with a  package name followed by :: or ::: to limit the search to that package.
与?,??可::或:::限制搜索到该包的包的名称前缀的格局。

Vignettes are searched as follows.  The "name" and  "alias" are both the base of the vignette filename, and the  "concept" entries are taken from the \VignetteKeywords entries.  Vignettes are not classified using the help system  "keyword" classifications.  Demos are handled similarly to vignettes, without the  "concept" search.
短文如下搜查。 "name"和"alias"基地的暗角的文件名,"concept"项\VignetteKeywords条目。护身符不使用的帮助系统"keyword"分类归类。演示处理类似护身符,没有"concept"搜索。


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

The results are returned in a list object of class "hsearch", which has a print method for nicely formatting the results of the query.  This mechanism is experimental, and may change in future versions of R.
返回结果列表对象的类"hsearch",其中有一个很好的格式化查询结果的打印方法。这种机制是实验性的,并可能改变未来版本的河

In R.app on Mac OS X, this will show up a browser with selectable items. On exiting this browser, the help pages for the selected items will be shown in separate help windows.
R.app Mac OS X上,这将显示一个可选项目的浏览器。退出该浏览器上,对所选项目的帮助页面将会显示在单独的帮助窗口。

The internal format of the class is undocumented and subject to change.
类的内部格式是无证和改变。


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

help; help.start for starting the hypertext (currently HTML) version of R's online documentation, which offers a similar search mechanism.
helphelp.start起超(目前HTML)版本的R的在线文档,它提供了一个类似的搜索机制。

RSiteSearch to access an on-line search of R resources.
RSiteSearch访问研发资源上线搜索。

apropos uses regexps and has nice examples.
apropos使用正则表达式,并具有很好的例子。


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


help.search("linear models")    # In case you forgot how to fit linear[万一你忘了如何适应线性]
                                # models[模型]
help.search("non-existent topic")

??utils::help  # All the topics matching "help" in the utils package[所有匹配utils包中的“帮助”主题]

## Not run: [#无法运行:]
help.search("print")            # All help pages with topics or title[主题或标题所有帮助页面]
                                # matching 'print'[匹配打印]
help.search(apropos = "print")  # The same[同一]

help.search(keyword = "hplot")  # All help pages documenting high-level[所有帮助页面记录高级别]
                                # plots.[图谋。]
file.show(file.path(R.home("doc"), "KEYWORDS"))  # show all keywords[显示所有的关键字]

## Help pages with documented topics starting with 'try'.[#帮助页记录开始与“尝试”的主题。]
help.search("\\btry", fields = "alias")


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 04:51 , Processed in 0.022746 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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