inst/doc/roxygen2.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(comment = "#>", collapse = TRUE)

## ----echo = FALSE-------------------------------------------------------------
example <- "#' Add together two numbers
#'
#' @param x A number.
#' @param y A number.
#' @return A number.
#' @examples
#' add(1, 1)
#' add(10, 1)
add <- function(x, y) {
  x + y
}
"

## ----code=example-------------------------------------------------------------
#' Add together two numbers
#'
#' @param x A number.
#' @param y A number.
#' @return A number.
#' @examples
#' add(1, 1)
#' add(10, 1)
add <- function(x, y) {
  x + y
}


## ----echo=FALSE, results="asis"-----------------------------------------------
cat(
  "\x60\x60\x60rd\n",
  format(roxygen2::roc_proc_text(roxygen2::rd_roclet(), example)[[1]]),
  "\n\x60\x60\x60", sep = ""
)

Try the roxygen2 package in your browser

Any scripts or data that you put into this service are public.

roxygen2 documentation built on June 28, 2024, 9:11 a.m.