Learn R Programming

rUM (version 2.2.0)

write_man: Write a manual page for package dataset documentation

Description

This function produces a roxygen2 R manual (man) page for a dataset that will be included in an R package. To be documented, the dataset needs to be in the global environment. The new documentation template will be named to match the datasets and will be saved in the R folder (i.e., using an analysis dataset will produce the R/analysis.Rd file). The page will indicate if the dataset is a data frame or tibble along with the number of rows and columns. For each variable documentation will indicate the variables a type, factor level information (if appropriate), and a generic description section. If the variable is labelled (using the labelled package or packages which use labelled, like tidyREDCap) the variable label will be used as the default description.

Usage

write_man(the_dataset)

Value

A .Rd file in the man package directory corresponding to the name of the supplied dataset.

Arguments

the_dataset

Dataset object (unquoted) or dataset as character (quoted)

Examples

Run this code
if (interactive()) {
  # Dataset object from Global Environment (unquoted)
  write_man(mtcars)
  
  # Dataset object from Global Environment as character string (quoted)
  write_man("mtcars")
}

Run the code above in your browser using DataLab