Skip to contents

Returns the median of the numeric column in a dataset like nitrate_tidy or temp_tidy for a specific site and month.

Usage

monthly_median(data, site, month, value = surfWaterNitrateMean)

Arguments

data

A tibble or data frame (e.g. nitrate_tidy or temp_tidy).

site

Site code to filter (e.g. "LEWI", "ARIK", "CARI").

month

Month label to filter (e.g. "Jan", "Feb", ... "Dec").

value

Name of numeric column to summarise (default = surfWaterNitrateMean).

Value

A single numeric value (the median) or NA if no matching data.

Examples

# Median nitrate for LEWI in January
monthly_median(nitrate_tidy, "LEWI", "Jan", surfWaterNitrateMean)
#> [1] 207.7

# Median temperature for LEWI in January
monthly_median(temp_tidy, "LEWI", "Jan", surfWaterTempMean)
#> [1] 7.424