Skip to contents

These functions provide readable names for common epidemiological summaries. The units of names such as rainy_days() and wet_days() depend on the time resolution of the input data. With hourly data they count hours; with daily data they count days.

Usage

humid_hours(threshold = 90, na.rm = TRUE)

dry_hours(threshold = 60, na.rm = TRUE)

proportion_humid(threshold = 90, na.rm = TRUE)

proportion_dry(threshold = 60, na.rm = TRUE)

max_consecutive_humid_hours(threshold = 90, na.rm = TRUE)

max_consecutive_dry_hours(threshold = 60, na.rm = TRUE)

rainy_hours(threshold = 0, na.rm = TRUE)

rainy_days(threshold = 0, na.rm = TRUE)

rain_events(threshold = 0.2, na.rm = TRUE)

rain_event_count(threshold = 0.2, na.rm = TRUE)

max_rain_event(threshold = 0.2, na.rm = TRUE)

mean_rain_event(threshold = 0.2, na.rm = TRUE)

hours_since_last_rain(threshold = 0.2, na.rm = TRUE)

days_since_last_rain(threshold = 0.2, na.rm = TRUE)

wet_hours(threshold = 0, na.rm = TRUE)

wet_days(threshold = 0, na.rm = TRUE)

proportion_wet(threshold = 0, na.rm = TRUE)

max_consecutive_wet_hours(threshold = 0, na.rm = TRUE)

wet_spell_count(threshold = 0, na.rm = TRUE)

mean_wet_spell_duration(threshold = 0, na.rm = TRUE)

max_wet_spell_duration(threshold = 0, na.rm = TRUE)

Arguments

threshold

A single finite numeric threshold.

na.rm

If TRUE, missing values are ignored. For proportion functions, the denominator is the number of non-missing observations.

Value

A function that takes a numeric vector and returns one numeric value.

Examples

humid_hours()(c(85, 91, 96))
#> [1] 2
rain_events(0.2)(c(0, 0.3, 0.4, 0, 1.2))
#> [1] 2