as.PWMs {TLMoments} | R Documentation |
Convert to PWMs-object
Description
Convert vector, matrix, list, or data.frame to PWMs-objects.
Usage
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 |
Value
object of class PWMs, see PWMs help page.
Methods (by class)
-
numeric
: as.PWMs for numeric data vectors -
matrix
: as.PWMs for numeric data matrices -
list
: as.PWMs for numeric data lists -
data.frame
: as.PWMs for numeric data.frames
See Also
Examples
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
[Package TLMoments version 0.7.5.3 Index]