Skip to contents

My median

Usage

my_median(x, na.rm = TRUE)

Arguments

x

Vector of Numeric values

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

Median of vector x

Examples

my_median(1:12)
#> [1] 6.5

# Example with your dataset in "inst/"
datafile <- system.file("nyc_squirrels_sample.csv", package = "SWMadagascar")
nyc_squirrels <- read.csv(datafile, encoding = "UTF-8")
# Apply my function
my_median(nyc_squirrels[, "hectare_squirrel_number"])
#> [1] 3