Rd2roxygen (version 1.7)

Rd2roxygen: Convert all the Rd files of a package to roxygen comments

Description

This function takes a package root directory, parses all its Rd files under the man directory and update the corresponding R source code by inserting roxygen documentation in to the R scripts.

Usage

Rd2roxygen(pkg, nomatch, usage = FALSE)

Arguments

pkg

the root directory of the package

nomatch

the file name (base name only) to use when an object in the Rd file is not found in any R source files (typically this happens to the data documentation); if not specified, the default will be `pkg'-package.R

usage

logical: whether to include the usage section in the output

Value

NULL (but the process of conversion will be printed on screen)

Examples

Run this code
# NOT RUN {
## a demo package
pkg = system.file("examples", "pkgDemo", package = "Rd2roxygen")
file.copy(pkg, tempdir(), recursive = TRUE)  # copy to temp dir first
od = setwd(tempdir())

## take a look at original R scripts
file.show("pkgDemo/R/foo.R")

options(roxygen.comment = "##' ")

## convert Rd's under man to roxygen comments
Rd2roxygen(file.path(tempdir(), "pkgDemo"))

file.show("pkgDemo/R/foo.R")  # what happened to foo.R and bar.R?

setwd(od)  # restore working directory
# }

Run the code above in your browser using DataLab