8

I have a question about creating an .Rd file for my R package using the roxygen2 package.

It is clear to me that, for documenting R functions, I can use C-c C-o in emacs to generate comments above the function, and then fill them out, followed by roxygenize("pkg"). In this way, I have .Rd files for the R functions. However, I am not sure how can I get .Rd file for the data examples and the package itself? Currently, I am using prompt("data") to generate data.Rd and promptPackage("pkg") to generate pkg-package.Rd. I have to put these files into the man folder, and then edit them separately. How can I document data and package in a similar way like documenting R functions using roxygen2?

Thank you very much!

alittleboy
  • 10,616
  • 23
  • 67
  • 107

1 Answers1

7

For data, see this previous question on SO which suggests:

#' 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

I would suspect that you can do the same for pkg-package.Rd. If it must be in roxygen format, consider

Community
  • 1
  • 1
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 1
    Thank you Dirk for the helpful suggestions! I used `prompt()` and `promptPackage()` to generate .Rd files, and then use `rd2roxygen` package to translate the .Rd files into `roxygen` format, both for the data and for the package itself. They work perfectly :) – alittleboy Sep 16 '12 at 20:21