calculate_stats_by_group: Function to calculate statistics of daily flow by group for...

Description Usage Arguments Value Examples

Description

This function traverses a collection of daily streamflow data and calculates the requested statistics for each time series. Available statistics include those implemented by calc_allHIT, calc_magnifSeven, calculate_other_flow_stats.

Usage

1
calculate_stats_by_group(stats, flow_data, yearType = "water", digits = 3)

Arguments

stats

string containing stat groups desired. options are: "all", "magAverage", "magLow", "magHigh", "frequencyLow", "frequencyHigh", "durationLow", "durationHigh", "timingAverage", "timingLow", "timingHigh", "rateChange", "calc_magnifSeven", "otherStat"

flow_data

A dataframe containing a NWCCompare flow dataset. Should have been cleaned by validate_data

yearType

A charcter of either "water" or "calendar" indicating whether to use water years or calendar years, respectively.

digits

A numeric. Number of digits to round indice values

Value

Data frame of calculated statistics. Time series ids are used as row names, statistic ids as column names.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sites <- c("02177000","02178400")
startdate <- "2008-10-01"
enddate <- "2013-09-30"
nwis_dataset <- build_nwis_dv_dataset(sites, startdate, enddate)
stats=c("calc_magAverage", "calc_magLow", "calc_magHigh",
        "calc_frequencyLow", "calc_frequencyHigh",
        "calc_durationLow", "calc_durationHigh",
        "calc_timingAverage", "calc_timingLow", "calc_timingHigh",
        "calc_rateChange",
        "calc_magnifSeven", "otherStat")
eflow_stats <- calculate_stats_by_group(stats, nwis_dataset)

USGS-R/NWCCompare documentation built on May 9, 2019, 6:10 p.m.