as.PWMs: Convert to PWMs-object

Description Usage Arguments Value Methods (by class) See Also Examples

View source: R/as.PWMs.R

Description

Convert vector, matrix, list, or data.frame to PWMs-objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
as.PWMs(x, ..., order = NULL)

## S3 method for class 'numeric'
as.PWMs(x, order = seq_along(x) - 1, ...)

## S3 method for class 'matrix'
as.PWMs(x, order = row(x)[, 1] - 1, ...)

## S3 method for class 'list'
as.PWMs(x, order = seq_along(x[[1]]) - 1, ...)

## S3 method for class 'data.frame'
as.PWMs(x, formula, order = NULL, ...)

Arguments

x

vector or matrix of PWMs.

...

additional arguments.

order

integer, corresponding order to given PWMs. If NULL, order is set to 0:(length(x)-1).

formula

if x is data.frame. See examples.

Value

object of class PWMs, see PWMs help page.

Methods (by class)

See Also

PWMs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
xmat <- cbind(c(0.12, .41, .38, .33), c(.05, 0.28, .25, .22))
xvec <- xmat[, 1]
xlist <- lapply(1:ncol(xmat), function(i) xmat[, i])
xdat <- data.frame(
 station = letters[1:3],
 season = c("S", "W", "S"),
 b0 = c(.12, .15, .05),
 b1 = c(.41, .33, .28),
 b2 = c(.38, .18, .25)
)

as.PWMs(xvec)
as.PWMs(xvec[-2], order = c(0, 2, 3))

as.PWMs(xmat)
as.PWMs(xmat[-2, ], order = c(0, 2, 3))

as.PWMs(xlist)

as.PWMs(xdat, cbind(b0, b1, b2) ~ station)
as.PWMs(xdat, . ~ station + season)
as.PWMs(xdat, cbind(b0, b2) ~ station, order = c(0, 2))

p <- as.PWMs(xdat, cbind(b0, b1, b2) ~ station)
TLMoments(p)

(p <- as.PWMs(xdat, cbind(b0, b1) ~ station))
#parameters(TLMoments(p), "gev") # => error
#parameters(TLMoments(p), "gpd") # => error
parameters(TLMoments(p), "gpd", u = 10)

(p <- as.PWMs(xdat, cbind(b0, b2) ~ station, order = c(0, 2)))
#TLMoments(p) # => error

TLMoments documentation built on Dec. 4, 2019, 5:06 p.m.