Documenting setter functions with roxygen

随声附和 提交于 2019-11-30 20:52:54

You can use the roxygen tag @usage

Here is an example from one of my packages:

#' @rdname pattern
#' @usage pattern(x) <- value
#' @param value New value
#' @export pattern<-
"pattern<-" <- function(x, value=c("^", "($|(_\\d+(_\\d+)*)$)")){
  attr(x, "pattern") <- value
  x
}

This results in my desired documentation:

Usage

  pattern(x) <- value

Arguments
x surveydata object

value New value
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!