Running examples in 'mev-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: egp
> ### Title: Extended generalised Pareto families
> ### Aliases: egp
> 
> ### ** Examples
> 
> set.seed(123)
> xdat <- evd::rgpd(1000, loc = 0, scale = 2, shape = 0.5)
> par <- fit.egp(xdat, thresh = 0, model = 'egp3')$par
> p <- c(1/1000, 1/1500, 1/2000)
> #With multiple thresholds
> th <- c(0, 0.1, 0.2, 1)
> opt <- tstab.egp(xdat, th, model = 'egp1')
> egp.retlev(xdat, opt$thresh, opt$par, 'egp1', p = p)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
mev
 --- call from context --- 
egp.retlev(xdat, opt$thresh, opt$par, "egp1", p = p)
 --- call from argument --- 
if (class(par) != "matrix") {
    par = matrix(c(par), ncol = 3)
}
 --- R stacktrace ---
where 1: egp.retlev(xdat, opt$thresh, opt$par, "egp1", p = p)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (xdat, thresh, par, model = c("egp1", "egp2", "egp3"), 
    p, plot = TRUE) 
{
    if (!(model %in% c("egp1", "egp2", "egp3")) || length(model) != 
        1) {
        stop("Invalid model selection")
    }
    if (length(par)%%3 != 0) {
        stop("Invalid parameter input")
    }
    if (class(par) != "matrix") {
        par = matrix(c(par), ncol = 3)
    }
    rate <- sapply(thresh, function(u) {
        length(xdat[xdat > u])/length(xdat)
    })
    if (!isTRUE(all.equal(length(rate), length(thresh), nrow(par)))) {
        stop("Input dimension does not match")
    }
    retlev <- matrix(0, nrow = length(thresh), ncol = length(p))
    if (any(sapply(rate, function(zeta) {
        zeta < p
    }))) {
        warning("Some probabilities `p` are higher than the exceedance rate. Evaluate those empirically")
    }
    p <- sort(p)
    for (i in 1:length(thresh)) {
        for (j in 1:length(p)) {
            pl = 1 - p[j]/rate[i]
            if (par[i, 3] == 0) {
                retlev[i, j] <- thresh[i] - par[i, 2] * switch(model, 
                  egp1 = -qgamma(pl, scale = 1, shape = par[i, 
                    1]), egp2 = -qgamma(pl, scale = 1, shape = par[i, 
                    1]), egp3 = log(1 - pl^(1/par[i, 1])))
            }
            else {
                retlev[i, j] <- thresh[i] + par[i, 2]/par[i, 
                  3] * (switch(model, egp1 = (1 - qbeta(pl, par[i, 
                  1], 1/abs(par[i, 3])))^(-sign(par[i, 3])), 
                  egp2 = exp(par[i, 3] * qgamma(pl, scale = 1, 
                    shape = par[i, 1])), egp3 = (1 - pl^(1/par[i, 
                    1]))^(-par[i, 3])) - 1)
            }
        }
    }
    if (plot) {
        matplot(1/p, t(retlev), , type = "b", lty = rep(1, length(thresh)), 
            col = rainbow(n = length(thresh), start = 2/6, end = 0), 
            xlab = "Return period", ylab = "Estimated return level", 
            main = paste0("Return level plot for EGP", substr(model, 
                4, 4), ""))
    }
    return(retlev)
}
<bytecode: 0x2839b28>
<environment: namespace:mev>
 --- function search by body ---
Function egp.retlev in namespace mev has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1