codoc(tools)
codoc()所属R语言包:tools
Check Code/Documentation Consistency
检查代码/文档的一致性
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Find inconsistencies between actual and documented "structure" of R objects in a package. codoc compares names and optionally also corresponding positions and default values of the arguments of functions. codocClasses and codocData compare slot names of S4 classes and variable names of data sets, respectively.
找到实际和文件包中的R对象的“结构”之间的不一致。 codoc名称,并选择相应的地位和功能参数的默认值进行比较。 codocClasses和codocDataS4的类和数据集的变量名比较插槽名,分别。
用法----------Usage----------
codoc(package, dir, lib.loc = NULL,
use.values = NULL, verbose = getOption("verbose"))
codocClasses(package, lib.loc = NULL)
codocData(package, lib.loc = NULL)
参数----------Arguments----------
参数:package
a character string naming an installed package.
一个字符串,命名已安装的软件包。
参数:dir
a character string specifying the path to a package's root source directory. This must contain the subdirectories "man" with R documentation sources (in Rd format) and "R" with R code. Only used if package is not given.
一个字符串,指定包的根源目录的路径。这必须包含的子目录manR中源(Rd格式)和RR代码。只用了package如果没有给出。
参数:lib.loc
a character vector of directory names of R libraries, or NULL. The default value of NULL corresponds to all libraries currently known. The specified library trees are used to search for package.
特征向量的研发图书馆的目录名,或NULL。默认值的NULL对应于目前已知的所有库。指定库树是用来搜索package。
参数:use.values
if FALSE, do not use function default values when comparing code and docs. Otherwise, compare all default values if TRUE, and only the ones documented in the usage otherwise (default).
如果FALSE,不使用功能的默认值比较时,代码和文档。否则,比较所有的默认值,如果TRUE,只有在使用,否则(默认)记录的。
参数:verbose
a logical. If TRUE, additional diagnostics are printed.
一个逻辑。如果TRUE,印有额外的诊断。
Details
详情----------Details----------
The purpose of codoc is to check whether the documented usage of function objects agrees with their formal arguments as defined in the R code. This is not always straightforward, in particular as the usage information for methods to generic functions often employs the name of the generic rather than the method.
的codoc的目的检查记录使用函数对象是否同意与他们的正式参数定义在R代码。这并不总是简单的,特别是在使用信息的通用功能的方法通常采用的通用名称,而不是方法。
The following algorithm is used. If an installed package is used, it is loaded (unless it is the base package), after possibly detaching an already loaded version of the package. Otherwise, if the sources are used, the R code files of the package are collected and sourced in a new environment. Then, the usage sections of the Rd files are extracted and parsed "as much as possible" to give the formals documented. For interpreted functions in the code environment, the formals are compared between code and documentation according to the values of the argument use.values. Synopsis sections are used if present; their occurrence is reported if verbose is true.
使用下面的算法。如果使用已安装的软件包,它被加载(除非它是base包)后,有可能分离的包已经加载的版本。否则,如果使用来源,R代码文件包都收集在一个新的环境源。然后,使用部分的路文件提取和分析,尽可能给形参记录。为解释代码环境中的功能,形参是比代码和文档之间根据参数use.values的值。如果目前使用概要部分;如果verbose是真实的,据报道其发生。
If a package has a namespace both exported and unexported objects are checked, as well as registered S3 methods. (In the unlikely event of differences the order is exported objects in the package, registered S3 methods and finally objects in the namespace and only the first found is checked.)
如果一个包有1检查出口和导出,对象的命名空间,以及注册S3的方法。 (在万一的出口订单在包对象的差异,注册S3的方法,终于在命名空间的对象,只找到的第一个被选中)。
Currently, the R documentation format has no high-level markup for the basic "structure" of classes and data sets (similar to the usage sections for function synopses). Variable names for data frames in documentation objects obtained by suitably editing "templates" created by prompt are recognized by codocData and used provided that the documentation object is for a single data frame (i.e., only has one alias). codocClasses analogously handles slot names for classes in documentation objects obtained by editing shells created by promptClass.
目前,在R格式的文件,有没有基本的类和数据集(类似功能概要使用部分)“结构”的高层次的标记。在适当的编辑模板创建prompt得到的文件对象的数据框的变量名确认codocData和使用提供的文档对象,是一个单一的数据框(即只有一个别名)。 codocClasses比照处理槽名称由编辑promptClass创建的炮弹获得文档对象类。
Help files named "<VAR>pkgname</VAR>-defunct.Rd" for the appropriate <VAR>pkgname</VAR> are checked more loosely, as they may have undocumented arguments.
帮助文件名为<VAR>pkgname</VAR>-defunct.Rd适当<VAR> PKGNAME </ VAR的检查较为松散,因为它们可能有无证参数。
值----------Value----------
codoc returns an object of class "codoc". Currently, this is a list which, for each Rd object in the package where an inconsistency was found, contains an element with a list of the mismatches (which in turn are lists with elements code and docs, giving the corresponding arguments obtained from the function's code and documented usage).
codoc类"codoc"返回一个对象。目前,这是一个列表,每路不一致的地方被发现的包对象,其中包含一个元素的不匹配(这又是元素code和docs名单列表,给函数的代码和文件的使用)获得相应的参数。
codocClasses and codocData return objects of class "codocClasses" and "codocData", respectively, with a structure similar to class "codoc".
codocClasses和codocData返回对象类"codocClasses"和"codocData",分别与结构相似的类"codoc"。
There are print methods for nicely displaying the information contained in such objects.
有print很好地显示在这些对象中包含的信息的方法。
注意----------Note----------
The default for use.values has been changed from FALSE to NULL, for R versions 1.9.0 and later.
默认的use.values已从FALSE改为NULL,R版本1.9.0及更高版本。
参见----------See Also----------
undoc, QC
undoc,QC
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|