compute.Q.stat.longterm: Compute long-term annual (calendar and water year) summary...

Description Usage Arguments Value Examples

View source: R/compute.Q.stat.longterm.R

Description

Computes long-term summary statistics on flow$Q variable between start.year and end.year inclusive for both calendar and water years. It (optionally) saves the results in *.csv and *.pdf files.

Usage

1
2
3
4
compute.Q.stat.longterm(Station.Code = "XXXXX", flow, start.year = 9999,
  end.year = 0, write.cy.stat.csv = TRUE, write.cy.stat.trans.csv = TRUE,
  write.wy.stat.csv = TRUE, write.wy.stat.trans.csv = TRUE,
  report.dir = ".", csv.nddigits = 3, na.rm = list(na.rm.global = TRUE))

Arguments

Station.Code

A character string. Used to name any *.csv or *.pdf files created so be careful that the Station.Code will be acceptable in a file name.

flow

Dataframe with two variables (1) Date with the date as a R date class variable and (2) Q a numeric variable with the flow for that day.

Missing values for Q can be explicitly represented using NA with the associated date, or implicitly represented by excluding the date from the data.frame.

The date range of flow can be wider than the start.year and end.year. This is useful for statistics on the water year (starting 1 October of the previous year) when you may wish to include flow data for the latter part of the year. Similarly, it may be useful for statistics that use a 3, 7, or 30 day rolling average as this will be missing for the first few days of each year.

A water year runs from 1 October of the previous year to 30 Sept of the current year

All other variables in the data frame will be ignored. Data does NOT have to be sorted by Date order.

start.year, end.year

Starting and ending year for statistics in YYYY format, e.g. start.year=2013.

write.cy.stat.csv

Should a file be created with the computed statistics? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-cy-summary-stat.csv')).

write.cy.stat.trans.csv

Should a file be created with the transposed of the statistics report? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-cy-summary-stat-trans.csv')).

write.wy.stat.csv

Should a file be created with the computed statistics? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-wy-summary-stat.csv')).

write.wy.stat.trans.csv

Should a file be created with the transposed of the statistics report? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-wy-summary-stat-trans.csv')).

report.dir

Directory in which *.csv or *.pdf files are stored.

csv.nddigits

Number of decimal digits to be rounded to when creating *.csv files.

na.rm

List of logical values indicating how to deal with missing values. na.rm$na.rm.global control if missing values are to be globally excluded (TRUE) or propogated (FALSE). If missing values are to be propogated, then any statistic computed over a missing value is also set to missing. For example, if a flow value was missing on 2014-01-03, then any statistics for January of 2014, JFM of 2014, calendar year 2014, water year 2014, 3 day rolling average of 1, 2, 3 of January 2014 and all statistics that depend on those rolling averages, will also be set to missing.

Value

A list with the following elements:

Q.cy.stat.longterm

Data frame with the long-term statistics of flow$Q by month and overall between start.year and end.year

Q.cy.stat.longterm.trans

Data frame with the long-term statistics of flow$Q transposed.

file.cy.stat.csv

Object with file name of *.csv file with long term summary statistics.

file.cy.stat.trans.csv

Object with file name of *.csv file with transposed long-term summary statistics.

Q.wy.stat.longterm

Data frame with the long-term statistics of flow$Q by month and overall between start.year and end.year

Q.wy.stat.longterm.trans

Data frame with the long-term statistics of flow$Q transposed.

file.wy.stat.csv

Object with file name of *.csv file with long-term summary statistics.

file.wy.stat.trans.csv

Object with file name of *.csv file with transposed long-term summary statistics.

na.rm

Missing value flags.

Version

Version of this function.

Date

Date function was run.

Examples

1
2
3
4
5
6
7
8
## Not run: 
stat.longterm <- compute.Q.stat.longterm(
                         Station.Code  ='ABCDE',
                         flow          =flow,
                         start.year    =1960,
                         end.year      =2015)

## End(Not run)

bcgov/BCWaterDischargeAnalysis documentation built on Dec. 21, 2020, 2:20 p.m.