Example Function with Mathematical Notation

Description

This is an example function that demonstrates basic functionality. It validates, cleans, calculates statistics, and formats the result.

Usage

example_function(x)

Arguments

x A numeric vector

Details

This function also demonstrates various ways to include mathematical notation in roxygen2 documentation.

Value

The median of the input vector, rounded to 2 decimal places

Mathematical Notation in roxygen2

Using 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.

Using for display equations (works in all formats)

The sample median for odd \(n\) is defined as:

\(m = x_{(n+1)/2}\)

Examples

Code
library("rpt")

example_function(c(1, 2, 3, 4, 5))
[1] 3
Code
example_function(c(1, NA, 3, 4, 5))
[1] 3.5