Learn R Programming

UKFE (version 0.2.3)

AMextract: Annual maximum extraction

Description

Extracts the annual maximum peaks (with other options) from a data.frame which has dates (or POSIXct) in the first column and variable in the second.

Usage

AMextract(
  x,
  func = NULL,
  Plot = TRUE,
  Title = "Hydrological annual maximum sequence",
  Ylabel = "Annual maximum quantiles"
)

Value

a data.frame with columns; WaterYear and AM

Arguments

x

a data.frame with dates (or POSIXct) in the first column and variable in the second

func

A user chosen function to extract statistics other than maximums.

Plot

a logical argument with a default of TRUE. If TRUE the extracted annual maximum is plotted

Title

Title of the plot when. Default is "Hydrological annual maximum sequence"

Ylabel

Label for the y axis. Default is "Annual maximum quantiles"

Author

Anthony Hammond

Details

The peaks are extracted based on the UK hydrological year, which starts October 1st and ends September 30th. If there are partial years (years with missing data) the maximum value may not be the true annual maximum of the year. If there are NAs for full years in the data, an -Inf will be returned for that year. The default is to extract maximums but the user can use the func argument to choose other statistics (mean or sum for example).

Examples

Run this code
#Extract the Thames AMAX daily mean flow and display the first six rows
ThamesAM <- AMextract(ThamesPQ[,c(1,3)])
head(ThamesAM)
#Extract the annual rainfall totals and change the plot labels accordingly
ThamesAnnualP <- AMextract(ThamesPQ[,1:2], func = sum, Title = "", Ylab = "Rainfall (mm)")

Run the code above in your browser using DataLab