dvStat: Daily Value Statistics

View source: R/dvStat.R

dvStatR Documentation

Daily Value Statistics

Description

Compute summary statistics for daily values, possibly grouped by years or seasons.

Usage

dvStat(x, Dates, Start = NULL, End = NULL, by = NULL, pre = NULL,
  stat = min, na.rm = TRUE, STAID = "Unknown", ...)

Arguments

x

the daily value data to be summarized. Missing values are permitted, but some summary statistics could be biased if missing data are present.

Dates

the date for each x, should be of class "Date." Missing values are not permitted.

Start

the start date for the analysis, can be either a character string or class "Date."

End

the end date for the analysis, can be either a character string or class "Date."

by

the grouping variable, generally the output from some date grouping function like waterYear, climateYear, or seasonYear. The default is to construct a group of the full range of data in calendar years.

pre

any preprocessing function like movingAve. The function must return a vector as long as the input vector.

stat

the statistical function. Must accept the na.rm argument and return a single value.

na.rm

remove missiing values option for the function stat.

STAID

the station identifier for the data.

...

any additional arguments for the function pre.

Value

A data.frame containing the STAID, groups generated by by, the number of non-missing values in the grouop, and the statistic and first date on which that statistic occurred.

Examples


## Not run: 
# For these examples, print to console
.pager <- options("pager")
options(pager="console")
# See the demo for examples of how to use the dvStat function.
demo(package="DVstats")
options(.pager)

## End(Not run)

USGS-R/DVstats documentation built on Oct. 11, 2022, 6:03 a.m.