2015-03-13 76 views
2

我想知道如何记录函数需要第二个函数或包。是否有特定的标签可以这么做,或者我应该在功能描述中这么说?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. 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 
} 
+0

''@seealso可能是你最好的选择 – kdopen 2015-03-13 15:48:53

+0

其实,我稍微误读。包内依赖可能最好用∘[email protected] seealso完成。 requirerequire依赖项适用于整个包,因此应该在包的元数据中处理。我相信它通常被认为是在函数内部使用requirerequire的错误形式。假设当然你正在创建一个新的包:( – kdopen 2015-03-13 16:42:11

+0

)在R扩展手册中指出'require()'和'library()'应该如果您打算提交给CRAN,则需要将RCurl添加到NAMESPACE文件 – 2015-03-15 05:25:42

回答

2

我结束了使用this post所示的想法,并写道:

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