Search code examples
rdocumentation-generationr-packageroxygen

How can I document data sets with roxygen?


Is it possible to include .R files in the data directory of my package in the roxygen process?

I have put several .R files in the data directory. When they are sourced with data(), they read in raw data files and perform some transformations.


Solution

  • Roxygen can be used anywhere within an R file (in other words, it doesn't have to be followed by a function). It can also be used to document any docType in the R documentation.

    So you can just document your data in a separate block (something like this):

    #' This is data to be included in my package
    #'
    #' @name data-name
    #' @docType data
    #' @author My Name \email{blahblah@@roxygen.org}
    #' @references \url{data_blah.com}
    #' @keywords data
    NULL