3

I wonder how one should document that a function requires a second function or a package. Are there specific tags do to so or should I just say so n the function description?

#' @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
}
Yuca
  • 71
  • 5
  • `@seealso ` is probably your best bet – kdopen Mar 13 '15 at 15:48
  • Actually, I misread slightly. An intra-package dependency is probably best done with ∘seealso@seealso. The requirerequire dependency applies to your entire package, so should be handled in the metadata for the package. I believe it's generally considered bad form to use requirerequire inside a function.... assuming of course you are creating a new package :( – kdopen Mar 13 '15 at 16:42
  • 1
    It's noted in the R Extensions manual that `require()` and `library()` should not be used in a package. If you plan on submitting to CRAN, you'll need to add RCurl to the NAMESPACE file – Rich Scriven Mar 15 '15 at 05:25

1 Answers1

4

I ended up using the idea shown in this post, and wrote the following:

#'@section Dependencies: 
#'  \describe {
#'    \item{package_1}
#'    \item{package_2}
#'    \item{package_n}
#'  }
Community
  • 1
  • 1
Yuca
  • 71
  • 5