calc_annual_anomaly | R Documentation |
Calculate annual anomaly
calc_annual_anomaly(x, year, period = NULL, max_missing = 0.2,
max_consecutive = NULL)
x |
metric. A vector |
year |
the year in which the metric was observed. A vector of the same length as x |
period |
the reference period of the anomaly. A vector of length 2 or NULL. If a vector, the first element indicates the beginning of the reference period and the second the end of the reference period. If NULL (the default) the reference period goes from the first to the last year. |
max_missing |
Numeric. Maximum number or proportion of missing values in x. If any number of missing values is allowed set to 1 (100%) or NULL. |
max_consecutive |
Numeric. Maximum number or proportion of consecutive missing values in x. If any number of missing values is allowed set to 1 (100%) or NULL. |
a vector with the anomaly of x
temperature_frame <- tibble::tibble(temperature = runif(100, 10, 20),
year = 1901:2000)
reference_period <- c(1961, 1990)
temperature_frame %>%
dplyr::mutate(anomaly = calc_annual_anomaly(temperature,
year,
reference_period))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.