函数的Roxygen2文档依赖关系
我想知道如何记录一个函数需要第二个函数或包。是否有特定的标签可以这样做,或者我应该在函数描述中这样说函数的Roxygen2文档依赖关系,r,roxygen2,R,Roxygen2,我想知道如何记录一个函数需要第二个函数或包。是否有特定的标签可以这样做,或者我应该在函数描述中这样说 #' @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.
#' @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
}
我最终使用了中所示的想法,并写了以下内容:
#'@section Dependencies:
#' \describe {
#' \item{package_1}
#' \item{package_2}
#' \item{package_n}
#' }
@see也
可能是你最好的选择。事实上,我有点误读了。包内依赖关系可能最好使用∘seealso@seealso. requirerequire依赖关系适用于整个包,因此应该在包的元数据中处理。我相信在函数中使用requirerequire通常被认为是不好的形式。。。。当然,假设您正在创建一个新包:(在R扩展手册中指出,require()
和library()
不应在包中使用。如果您计划提交给CRAN,则需要将RCurl添加到命名空间文件中