How can I document data sets with roxygen?

Karsten W. picture Karsten W. · Feb 22, 2010 · Viewed 11.5k times · Source

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.

Answer

Shane picture Shane · Feb 22, 2010

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