Description Usage Arguments Details Value Examples
Determines the longest interval of consecutive days that are
considered "dry". Values of x
that are less than rain_cutoff
are categorized as dry.
1 2 3 4 5 6 | dry_interval(
x,
rain_cutoff = 1,
period = c("start", "mid", "end"),
na.rm = TRUE
)
|
x |
numeric vector of rainfall measurements |
rain_cutoff |
minimum amount of rainfall to count as non-dry day |
period |
period to measure longest dry spell; see |
na.rm |
logical indicating treatment of |
Missing values are not simply removed for purpose of calculation.
If x
includes NA
values and na.rm = FALSE
, NA
is
returned. However, when x
includes NA
values and
na.rm = TRUE
, special consideration is required. In contrast with
other methods, NA
cannot be dropped without significant implications
on calculations. Consider a vector of c(0, 0, NA, 0)
. If NA
values are removed, the vector reduces to c(0, 0, 0)
and the longest
consectutive stretch of dry days becomes 3. This is not an accurate
representation of the data. Instead, when na.rm = TRUE
, vectors with
NA
values will evaluate missing values as non-dry days. In the
example above, this results in the longest dry interval being 2. This
provides a more accurate representation of dry day intervals based on
non-missing data.
numeric vector of length 1 with the number of days that have rainfall
less than rain_cutoff
; value returned is determined by value of
period
:
number of consecutive days at beginning of season with less
than rain_cutoff
of measured rain; if first day of season had
rainfall greater than or equal to rain_cutoff
, the returned value
will be zero
longest stretch of days with less than rain_cutoff
contained within the period; if rainfall was less than rain_cutoff
for every day in defined season, the returned value will be zero
number of consecutive days at end of season with less
than rain_cutoff
of measured rain; if last day of season had
rainfall greater than or equal to rain_cutoff
, the returned value
will be zero
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
rain <- c(0, 2, 3, 0, 0, 2, 0, 3, 0, 0, 0)
# Longest interval at the end of season
dry_test <- wxsumR:::dry_interval(x = rain, period = "end")
dry_test
# 3
# Longest interval in middle of season
dry_test <- wxsumR:::dry_interval(x = rain, period = "mid")
dry_test
# 2
# Longest interval at start of season, considering days with rain of 2 or
# lower (unitless) as dry days
dry_test <- wxsumR:::dry_interval(x = rain, rain_cutoff = 2, period = "start")
dry_test
# 2
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.