vary_threshold | R Documentation |
Helper function to easily create a daily, weekly, monthly or seasonal varying threshold.
vary_threshold(x, varying = "constant", fun = function(x) quantile(x, probs = 0.05, na.rm = TRUE), ...)
x |
an object which can be coerced to class |
varying |
if |
fun |
a function accepting a single argument and returning either a vector of length one or a vector as long as |
... |
additional arguments, passed on to |
a vector as long as x
.
data(ngaruroro) ng <- as.xts(ngaruroro)["1983::1985", ] r <- find_droughts(ng, varying = "monthly") plot(r) thr1 <- vary_threshold(ng, varying = "weekly", fun = mean, na.rm = TRUE) plot(thr1) thr2 <- vary_threshold(ng, varying = "monthly", fun = mean, na.rm = TRUE) lines(thr2, col = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.