是否可以从另一个包中的函数使用@inheritParams? [英] Is it possible to @inheritParams from a function within another package?
问题描述
我为模糊的TSV格式编写了一个导入程序,我希望将其打包并记录: https://github.com/katrinleinweber/MWX-import/commits/package
I wrote an importer for an obscure TSV format, which I want to package and document: https://github.com/katrinleinweber/MWX-import/commits/package
importer函数传递了重命名的 skip_lines
的 utils :: read.table
参数,因此我想传递后者的 skip $ c的文档$ c>放入我的
.Rd
。但是,尝试使用 @inheritParams utils :: read.table skip
这样的符号总是会导致警告:无法找到主题[…]
。
The importer function passes a renamed skip_lines
parameter to utils::read.table
so I would like to "pass" the latter's documentation of skip
into my .Rd
. However, trying a few notations like @inheritParams utils::read.table skip
always results in Warning: Failed to find topic […]
.
在阅读<后,我是否还可以从另一个包的函数中继承单个特定的参数,实际上是否可行a href = http://r-pkgs.had.co.nz/man.html rel = noreferrer> http://r-pkgs.had.co.nz/man.html 和 https://blog.rstudio.org/2017/02/ 01 / roxygen2-6-0-0 / 。
Whether it's actually possible to inherit a single, specific parameter from another package's function is not clear to me after reading http://r-pkgs.had.co.nz/man.html and https://blog.rstudio.org/2017/02/01/roxygen2-6-0-0/.
有可能吗?如果是,则感谢您提供任何提示!
Is it possible? If yes, thanks for any hint!
推荐答案
如果使用 @inheritParams utils :: read.table
,那么您函数中与 utils :: read.table
中的参数相匹配的任何参数都将被继承(前提是尚未明确记录) 。因此,如果您使用 skip
而不是 skip_lines
,这将涵盖您的用例。
If you use @inheritParams utils::read.table
, then any parameters in your function which match those in utils::read.table
will be inherited (provided they aren't already explicitly documented). So this would cover your use case if you used skip
instead of skip_lines
.
当您的参数名称不匹配时,我认为无法继承该参数的文档。
I don't think it's possible to inherit documentation for a parameter when your parameter name doesn't match though.
这篇关于是否可以从另一个包中的函数使用@inheritParams?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!