roxygen2
Basic documentation
| Action |
Code |
Details |
|
Title
|
|
|
|
Description
|
@description Description here
|
|
|
Parameter
|
|
|
|
Dot parameters
|
@param ... Additional arguments
|
|
|
Return
|
@return Return value description here
|
|
|
Class slot
|
@slot slotName Description here
|
|
|
Details
|
|
|
|
Note
|
|
|
|
Data format
|
@format Format description here
|
|
Text formatting
| Action |
Code |
Details |
|
Enable markdown
|
|
|
|
Emphasis
|
|
|
|
Bold
|
|
|
|
In-line equation
|
|
|
|
Display equation
|
|
|
|
Code
|
|
|
|
Code
|
|
|
|
Code block
|
mu <- mean(data)
|
|
|
Monospace font (looks like code)
|
|
|
|
Package name
|
|
|
|
Unordered list
|
\itemize{
\item Option A
\item Option B
}
|
|
|
Ordered list
|
\enumerate{
\item First item
\item Second item
}
|
|
|
Named list
|
\describe{
\item{Opt A}{Describe option A}<
\item{Opt B}{Describe option B}
}
|
|
|
Table
|
|
Use markdown? |
|
Sections
|
@details First part
@details Second part (will be a new section)
|
|
|
Arbitrary sections
|
@section Title:
Text here
|
|
|
Subsections
|
@details
## This is a subsection
With text
#### Subsubsection here
With text
|
|
Link
| Action |
Code |
Details |
|
Website
|
|
|
|
With different text
|
|
|
|
To internal topic defined by @name name
|
|
|
|
To external package
|
|
|
|
To external package function
|
|
|
|
To internal or global function
|
|
|
|
To package function
|
|
|
|
To function with different text
|
[fancyName()][stats::predict()]
|
|
|
To class
|
|
|
|
To external class
|
|
|
|
To S4 class
|
|
|
|
With special characters
|
\code{\link[magrittr]{\%>\%}}
|
|
|
See-also
|
@seealso [mean] [stats::median]
|
|
|
See-also vignette
|
@seealso browseVignettes('roxygen2')
|
|
|
Family
|
|
|
|
Specify source
|
@source This dataset was generated using [generateData]
|
|
|
References
|
@references
\insertRef{benaglia2009mixtools}{latrend}
|
|
|
E-mail
|
\email{example@@example.com}
|
|
Examples
Documenting code examples
| Action |
Code |
Details |
|
Examples
|
@examples
1 + 1
mean(1:9)
|
|
|
Examples that should not be run
|
@examples
1 + 1
\dontrun{
stop('oops')
}
|
|
|
Examples that should not be tested
|
@examples
\donttest{
stop('oops')
}
|
|
|
Examples for interactive usage only
|
@examples
if interactive()
browseURL("https://roxygen2.r-lib.org")
|
|
Dynamic content
| Action |
Code |
Details |
|
In-line code evaluation
|
|
Evaluated during every roxygenize call |
|
Code block evaluation
|
</td>
<td markdown="1">Code blocks cannot refer to each other</td>
</tr>
<tr markdown="1">
<td markdown="1">
Generate figure
</td>
<td>
```R
```{r iris-pairs-plot}
pairs(iris[1:4])[unclass(iris$Species)])
</td>
<td markdown="1"></td>
</tr>
<tr markdown="1">
<td markdown="1">
Dynamic documentation
</td>
<td>
```R

|
|
Generating documentation
| Action |
Code |
Details |
|
Generate docs
|
|
Ctrl+Shift+D |
|
Clean files, then generate docs
|
roxygen2::roxygenise(clean = TRUE)
|
|
Topics
| Action |
Code |
Details |
|
Don't generate topic
|
|
|
|
Create stand-alone topic
|
@name docname
@title Topic title
NULL
|
|
|
Package topic
|
@details
Package documentation here.
@keywords internal
"_PACKAGE"
|
|
|
Topic name
|
|
|
|
Topic file name
|
|
|
|
Specify doc inclusion order
|
|
Then @order 2 for the second doc |
|
Define alias
|
|
|
|
Define alias for S4 method
|
@aliases predictForCluster,lcModel-method
|
|
|
Inherit doc
|
|
|
|
Inherit doc components
|
@inherit docName details return
|
|
|
Inherit section
|
@inheritSection docName Section title
|
|
|
Inherit param descriptions from another internal function
|
@inheritParams internalFun
|
|
|
Inherit param descriptions from an external function
|
@inheritParams stats::predict
|
|
|
Inherit dot parameters
|
|
|
|
Hide documentation
|
|
|
Namespace generation
| Action |
Code |
Details |
|
Import package
|
|
|
|
Import packages
|
|
|
|
Import function(s) from package
|
@importFrom stats predict fitted
|
|
|
Import S3 generic
|
|
|
|
Import S4 classes from package
|
@importClassesFrom stats Time
|
|
|
Import S4 methods from package
|
@importMethodsFrom stats time time2
|
|
|
Collate / ensure other R files are loaded first
|
@include first.R second.R
|
|
|
Export function
|
|
|
|
Export class and methods
|
|
|
|
Export class
|
|
|
|
Export class method
|
|
|