roxygen2 v7.1.1
Monthly downloads
In-Line Documentation for R
Generate your Rd documentation, 'NAMESPACE' file,
and collation field using specially formatted comments. Writing
documentation in-line with code makes it easier to keep your
documentation up-to-date as your requirements change. 'Roxygen2' is
inspired by the 'Doxygen' system for C++.
Readme
roxygen2 
The premise of roxygen2 is simple: describe your functions in comments next to their definitions and roxygen2 will process your source code and comments to automatically generate .Rd
files in man/
, NAMESPACE
, and, if needed, the Collate
field in DESCRIPTION
.
Installation
# Install devtools from CRAN
install.packages("roxygen2")
# Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("r-lib/roxygen2")
Usage
The premise of roxygen2 is simple: describe your functions in comments next to their definitions and roxygen2 will process your source code and comments to produce Rd files in the man/
directory. Here's a simple example from the stringr package:
#' The length of a string
#'
#' Technically this returns the number of "code points", in a string. One
#' code point usually corresponds to one character, but not always. For example,
#' an u with a umlaut might be represented as a single character or as the
#' combination a u and an umlaut.
#'
#' @inheritParams str_detect
#' @return A numeric vector giving number of characters (code points) in each
#' element of the character vector. Missing string have missing length.
#' @seealso [stringi::stri_length()] which this function wraps.
#' @export
#' @examples
#' str_length(letters)
#' str_length(NA)
#' str_length(factor("abc"))
#' str_length(c("i", "like", "programming", NA))
str_length <- function(string) {
}
When you roxygenise()
(or devtools::document()
) your package these comments will be automatically transformed to the .Rd
that R uses to generate the documentation you see when you type ?str_length
.
Learn more
To get started, first read vignette("roxygen2")
. Then read more about the specific package component that you want to generate:
- For
.Rd
documentation files, readvignette("rd")
. - For the
NAMESPACE
, readvignette("namespace")
. - For the
Collate
field in theDESCRIPTION
, readupdate_collate()
.
Functions in roxygen2
Name | Description | |
markdown-test | Dummy page to test roxygen's markdown formatting | |
namespace_roclet | Roclet: make NAMESPACE | |
load | Load package code | |
is_s3_generic | Determine if a function is an S3 generic or S3 method. | |
RoxyTopic | A RoxyTopic is an ordered collection of unique rd_sections | |
load_options | Load roxygen2 options | |
escape_examples | Escape examples | |
escape_rd_for_md | Escape Rd markup, to avoid interpreting it as markdown | |
markdown_pass1 | Expand the embedded inline code | |
double_escape_md | Check markdown escaping | |
roclet_find | Create a roclet from a string. | |
object | Constructors for S3 object to represent R objects. | |
roclet | Build a new roclet. | |
roxy_block | Blocks | |
object_format | Default format for data | |
rd_roclet | Roclet: make Rd files. | |
update_collate | Update Collate field in DESCRIPTION | |
vignette_roclet | Re-build outdated vignettes. | |
parse_package | Parse a package, file, or inline code | |
roxygenize | Process a package with the Rd, namespace and collate roclets. | |
roc_proc_text | Process roclet on string and capture results. | |
rd_section | Construct an rd_section object | |
tag_parsers | Parse tags | |
roxy_tag_rd | Generate Rd output from a tag | |
roxy_tag | roxy_tag S3 constructor | |
roxygen2-package | roxygen2: In-Line Documentation for R | |
No Results! |
Vignettes of roxygen2
Name | ||
extending.Rmd | ||
namespace.Rmd | ||
rd-formatting.Rmd | ||
rd.Rmd | ||
roxygen2.Rmd | ||
No Results! |
Last month downloads
Details
License | GPL (>= 2) |
URL | https://roxygen2.r-lib.org/, https://github.com/r-lib/roxygen2 |
BugReports | https://github.com/r-lib/roxygen2/issues |
LinkingTo | Rcpp |
VignetteBuilder | knitr |
Encoding | UTF-8 |
RoxygenNote | 7.1.0.9000 |
Language | en-GB |
NeedsCompilation | yes |
Packaged | 2020-06-26 21:30:42 UTC; hadley |
Repository | CRAN |
Date/Publication | 2020-06-27 14:50:02 UTC |
imports | brew , commonmark , desc (>= 1.2.0) , digest , knitr , methods , pkgload (>= 1.0.2) , purrr (>= 0.3.3) , R6 (>= 2.1.2) , Rcpp (>= 0.11.0) , rlang , stringi , stringr (>= 1.0.0) , utils , xml2 |
suggests | covr , devtools , R.methodsS3 , R.oo , rmarkdown , testthat (>= 2.1.0) |
depends | R (>= 3.2) |
Contributors | Peter Danenberg, RStudio, Gabor Csardi, Manuel Eugster |
Include our badge in your README
[](http://www.rdocumentation.org/packages/roxygen2)