简体   繁体   English

使用roxygen2导出变体函数

[英]Use roxygen2 to export a variant function

When I use @describeIn or @rdname to document a variant of a function, the variant doesn't get exported. 当我使用@describeIn@rdname记录函数的变体时,该变体不会导出。 Is there a tag I can place in the roxygen skeleton to change this, or do I need to go directly into the NAMESPACE? 我可以在制氧剂骨架中放置一个标签来更改此标记吗,还是我需要直接进入名称空间?

#' Title
#'
#' @return
#' @export
#'
#' @examples
foo <- function() {
  "foo"
}

#' @rdname foo A variant
#'
#' @export
bar <- function() foo()

When I attach this package, I can call foo just fine, but trying to call bar results in Error: could not find function "bar" . 当我附加这个包时,我可以很好地调用foo ,但是尝试调用bar导致Error: could not find function "bar"

The problem is the line of text after @rdname foo . 问题是@rdname foo之后的文本行。 Note the message about "invalid path" given when running roxygen: 请注意在运行roxygen时给出的有关“无效路径”的消息:

> devtools::document()
Updating mypackage documentation
Loading mypackage
Writing NAMESPACE
Writing foo.Rd
Skipping invalid path:  foo A variant..Rd 

This can be fixed by removing that label text: 可以通过删除该标签文本来解决此问题:

#' @rdname foo
#' @export

Or by using @describeIn : 或使用@describeIn

#' @describeIn foo A variant.
#' @export

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM