Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

safe_median

Safe version of median


Description

safe_median() works stats::median() but warns if some elements of ... are never used.

Usage

safe_median(x, ...)

## S3 method for class 'numeric'
safe_median(x, ..., na.rm = TRUE)

Arguments

x

Numeric vector

...

Additional arguments passed on to methods.

na.rm

For numeric method, should missing values be removed?

Examples

x <- c(1:10, NA)
safe_median(x, na.rm = TRUE)
median(x, na.rm = TRUE)

try(median(x, na.mr = TRUE))
try(safe_median(x, na.mr = TRUE))

try(median(1, 2, 3))
try(safe_median(1, 2, 3))

ellipsis

Tools for Working with ...

v0.3.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.