annualMax: Annual maxima from time series

Description Usage Arguments Value Author(s) See Also Examples

View source: R/annualMax.R

Description

Get annual maxima and more information from time series

Usage

1
annualMax(dates, values, data, shift = 0, missing2NA = TRUE)

Arguments

dates

Dates in ascending order. Can be charater strings or strptime results, as accepted (and coerced) by as.Date

values

Values to be mapped in color with colPoints

data

Optional: data.frame with the column names as given by dates and values

shift

Number of days to move the year-break to. E.g. shift=61 for German hydrological year (Nov to Oct). DEFAULT: 0

missing2NA

Logical. If years are completely missing in dates, insert NA rows for those? DEFAULT: TRUE

Value

data.frame with one row per (hydrological) year (h_year) with the columns:
year, max, date, doy (day of h_year), n (number of non-NA values), days (number of days per h_year in input data) and rownr.
The rownames of the output are character strings with the h_year.

Author(s)

Berry Boessenkool, berry-b@gmx.de, Jun 2017

See Also

qdoyCompute

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
load(seasFolder("data/dismeta.Rdata"))
annmax <- annualMax("date","Koeln", dis)
head(annmax)
plot(annmax[,1:2], type="l", las=1, xlab="year")
plot(annmax$year, annmax$doy)

head(annualMax("date","Koeln", dis))
head(annualMax("date","Koeln", dis, shift=117)) # hydrological year
berryFunctions::seasonality("date","Koeln", dis, shift=117)
annmax <- annualMax("date","Koeln", dis, shift=117)
berryFunctions::linReg(doy~year, data=annmax); abline(h=150)
berryFunctions::linReg(doy~year, data=annmax[120:190,]); abline(h=150)
# No real trend in timing of annual streamflow maximum in Cologne

dis2 <- dis[dis$Koeln>9000,]
head(annualMax("date","Koeln", dis2))
head(annualMax("date","Koeln", dis2, missing2NA=FALSE))
#View(dis[,c("date","Koeln")])
plot(head(dis[,c("date","Koeln")], 500), type="l")

ERottler/rfs documentation built on May 20, 2019, 3:04 p.m.