Calculate all characteristic stats from a list of files
Calculate all characteristic stats from a list of files
Function takes a vector of file names and returns seasonal signal-to-noise ratio, daily and annual noise color, 2- and 10-year return levels, and σ for high- and low-flow events.
All files in the vector should be of the same format.
names: Optional character vector with names of sites.
file.type: Character string, "txt" or "csv". Defaults to "txt".
date.col: Numeric specifying column containing date in "MM-DD-YYYY" format. Defaults to 3.
dis.col: Numeric specifying column containing discharge data. Defaults to 4.
skipped.rows: Numeric indicating number of rows to skip at beginning of file.
Returns
A data frame with one row for each file and the following columns: - a.rms: Root mean squared amplitude.
n.rms: Root mean squared noise.
snr: Signal-to-noise ratio.
theta.d: Daily noise color.
theta.a: Annual noise color.
sigma.lf: Sigma for low flow events.
sigma.hf: Sigma for high flow events.
q2: 2-year return level (flood).
q10: 10-year return level (flood).
l2: 2-year return level (drought).
l10: 10-year return level (drought).
Note
The arguments "date.col", "discharge.col", and "skipped.rows" are designed to give some flexibility in file input; however, tab-delimited text without extra columns will work best.
Examples
# this function works on list of files# read R data into temporary file handledata(sycamore)f = tempfile(fileext="txt")write.table(sycamore, file=f, sep="\t")# print all statistics for the list of riversparameters.list(c(f), names=c("sycamore"), date.col=2,dis.col=3,skipped.rows =1)