【发布时间】: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 文件中