seas2ann: Annual maxima from seasonal maxima

Description Usage Arguments Value Examples

View source: R/seas2ann.R

Description

Calculates annual maxima from seasonal maxima of two seasons.

Usage

1
seas2ann(x1, x2, na.rm = TRUE)

Arguments

x1

vector or matrix of observations from season 1 (rows: observations, columns: stations).

x2

vector or matrix of observations from season 2 (rows: observations, columns: stations).

na.rm

logical. TRUE: the annual maximum will be calculated even if one observation of the two seasons is a missing value, e.g. winter maximum is 58 and summer maximum is NA the annual maximum is 58. If both observations are NA, the annual maximum is set to NA, too. FALSE: the annual maximum will be set to NA if one observation of the two seasons is a missing value, e.g. winter maximum is 58 and summer maximum is NA the annual maximum is NA.

Value

Matrix of annual observations (rows: observations, columns: stations).

Examples

1
2
3
4
5
6
7
8
9
set.seed(28379)
x1 <- matrix(round(rnorm(8, 20, 25)), ncol=2)
x1[2] <- NA
x2 <- matrix(round(rnorm(8, 20, 25)), ncol=2)
x2[c(2,5,6)] <- NA
x1
x2
seas2ann(x1,x2,TRUE)
seas2ann(x1,x2,FALSE)

Example output

     [,1] [,2]
[1,]   47    7
[2,]   NA   35
[3,]   50   13
[4,]    5   22
     [,1] [,2]
[1,]   56   NA
[2,]   NA   NA
[3,]  -10   20
[4,]   57   54
     [,1] [,2]
[1,]   56    7
[2,]   NA   35
[3,]   50   20
[4,]   57   54
     [,1] [,2]
[1,]   56   NA
[2,]   NA   NA
[3,]   50   20
[4,]   57   54

flood documentation built on May 2, 2019, 4:04 p.m.

Related to seas2ann in flood...