2015-03-13 78 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} 
#' }