library("rpt")
example_function(c(1, 2, 3, 4, 5))[1] 3
This is an example function that demonstrates basic functionality and various ways to include mathematical notation in roxygen2 documentation.
example_function(x)
x
|
A numeric vector |
The median of the input vector
for inline math (works in all formats)
The median is a measure of central tendency where \(x_{0.5}\) represents the value that splits the data in half.
for display equations (works in all formats)
The sample median for odd \(n\) is defined as:
\(m = x_{(n+1)/2}\)
$$ for display math (HTML/pkgdown only, requires roxygen2 >= 7.0.0)
For even sample sizes, the median is the average of the two middle values: $$m = (n/2) + x(n/2+1)2$$
$ for inline math (HTML/pkgdown only, requires roxygen2 >= 7.0.0)
In general, the median minimizes $_i=1^n |x_i - m|$.
library("rpt")
example_function(c(1, 2, 3, 4, 5))[1] 3