【问题标题】:Roxygen2 document dependency of a functionRoxygen2 记录函数的依赖关系
【发布时间】:2015-03-13 15:32:04
【问题描述】:

我想知道如何记录一个函数需要第二个函数或包。是否有特定的标签可以这样做,还是我应该在功能描述中这么说?

#' @title Downloads stuff from that place
#' 
#' @details Maybe document the dependency here?
#' 
#' @param stuff Thing to be downloaded
#' @param save_to Where to place the thing
#' @return Nothing. Called for its side effect

download_stuff = function(stuff, save_to) {

    require('RCurl')               # How do document this?

    # thing = download stuff using RCurl
    # write thing to save_to
}

【问题讨论】:

  • @seealso 可能是你最好的选择
  • 其实我看错了。包内依赖可能最好使用 ∘seealso@seealso 来完成。 requirerequire 依赖项适用于您的整个包,因此应在包的元数据中处理。我相信在函数中使用 requirerequire 通常被认为是不好的形式...... 当然假设你正在创建一个新包:(
  • R Extensions 手册中指出 require()library() 不应在包中使用。如果您打算提交给 CRAN,则需要将 RCurl 添加到 NAMESPACE 文件中

标签: r roxygen2


【解决方案1】:

我最终使用了this post中显示的想法,并写了以下内容:

#'@section Dependencies: 
#'  \describe {
#'    \item{package_1}
#'    \item{package_2}
#'    \item{package_n}
#'  }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-20
    • 1970-01-01
    • 1970-01-01
    • 2021-02-10
    • 2015-12-28
    相关资源
    最近更新 更多