Running examples in ‘lmomRFA-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: regquantbounds
> ### Title: Compute error bounds for a regional frequency distribution
> ### Aliases: regquantbounds sitequantbounds
> ### Keywords: misc
> 
> ### ** Examples
> 
> data(Cascades)              # A regional data set
> 
> rmom <- regavlmom(Cascades) # Regional average L-moments
> 
> # Fit a generalized normal distribution to the regional data
> rfit <- regfit(Cascades, "gno")
> 
> # Set up an artificial region to be simulated:
> # -- Same number of sites as Cascades
> # -- Same record lengths as Cascades
> # -- Same site means as Cascades
> # -- L-CV varies linearly across sites, with mean value equal
> #    to the regional average L-CV for the Cascades data.
> #      'LCVrange' specifies the  range of L-CV across the sites,
> #    and is chosen to reflect the amount of heterogeneity that
> #    may reasonably be believed to be present in the Cascades
> #    data (see the example for 'regsimh').
> # -- L-skewness is the same at each site, and is equal to the
> #    regional average L-skewness for the Cascades data
> nsites <- nrow(Cascades)
> means <- Cascades$mean
> LCVrange <- 0.025
> LCVs <- seq(rmom[2]-LCVrange/2, rmom[2]+LCVrange/2, len=nsites)
> Lskews<-rep(rmom[3], nsites)
> 
> # Each site will have a generalized normal distribution:
> # get the parameter values for each site
> pp <- t(apply(cbind(means, means*LCVs ,Lskews), 1, pelgno))
> pp
           xi     alpha           k
t_3  19.58775  3.407642 -0.05702846
t_3  62.26646 10.986980 -0.05702846
t_3  40.64446  7.272692 -0.05702846
t_3  45.80784  8.310375 -0.05702846
t_3  44.78596  8.236240 -0.05702846
t_3  30.87776  5.755205 -0.05702846
t_3  79.71335 15.055583 -0.05702846
t_3  41.08067  7.861060 -0.05702846
t_3  30.41674  5.896048 -0.05702846
t_3  32.74852  6.429453 -0.05702846
t_3  17.46093  3.471482 -0.05702846
t_3  69.12093 13.914099 -0.05702846
t_3  47.37747  9.654947 -0.05702846
t_3 101.90115 21.019659 -0.05702846
t_3  52.10260 10.877073 -0.05702846
t_3  79.21843 16.734937 -0.05702846
t_3  44.37235  9.484096 -0.05702846
t_3  58.29528 12.605046 -0.05702846
t_3  38.78194  8.482252 -0.05702846
> 
> # Set correlation between each pair of sites to 0.64, the
> # average inter-site correlation for the Cascades data
> avcor <- 0.64
> 
> # Run the simulation.  To save time, use only 100 replications.
> simq <- regsimq(qfunc=quagno, para=pp, cor=avcor, nrec=Cascades$n,  nrep=100, fit="gno")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
lmomRFA
 --- call from context --- 
regsimq(qfunc = quagno, para = pp, cor = avcor, nrec = Cascades$n, 
    nrep = 100, fit = "gno")
 --- call from argument --- 
if (class(cholcor) == "try-error") stop("Correlation matrix is not positive definite")
 --- R stacktrace ---
where 1: regsimq(qfunc = quagno, para = pp, cor = avcor, nrec = Cascades$n, 
    nrep = 100, fit = "gno")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (qfunc, para, cor = 0, index = NULL, nrec, nrep = 10000, 
    fit = "gev", f = c(0.01, 0.1, 0.5, 0.9, 0.99, 0.999), boundprob = c(0.05, 
        0.95), save = TRUE) 
{
    nsites <- length(nrec)
    nmax <- max(nrec)
    if (any(nrec <= 0)) 
        stop("record lengths must all be positive")
    if (!is.list(qfunc)) 
        qfunc <- list(qfunc)
    if (!all(sapply(qfunc, is.function))) 
        stop("'qfunc' must be a function or a list of functions")
    if (!is.element(length(qfunc), c(1, nsites))) 
        stop("list 'qfunc' must have either 1 or 'length(nrec)' components")
    q2qua <- function(f) function(u, p) do.call(f, c(list(u), 
        as.list(p)))
    qfunc <- lapply(qfunc, function(func) if (length(formals(func)) == 
        2) 
        func
    else q2qua(func))
    if (length(qfunc) == 1) 
        qfunc <- rep(qfunc, nsites)
    if (missing(para)) 
        para <- list(NULL)
    else if (is.vector(para) && is.numeric(para)) 
        para <- list(para)
    else {
        if (is.data.frame(para)) 
            para <- as.matrix(para)
        if (is.matrix(para)) {
            if (!is.element(nrow(para), c(1, nsites))) 
                stop("matrix or data frame 'para' must have either 1 or 'length(nrec)' rows")
            para <- lapply(split(para, row(para)), function(x) x[!is.na(x)])
        }
        else if (is.list(para)) {
            if (!is.element(length(para), c(1, nsites))) 
                stop("list 'para' must have either 1 or 'length(nrec)' components")
            para <- lapply(para, unlist)
        }
        else stop("'para' must be a vector, matrix, data frame or list")
    }
    if (length(para) == 1) 
        para <- rep(para, nsites)
    nocorr <- identical(cor, 0)
    if (!nocorr) {
        if (is.matrix(cor)) {
            cor <- cov2cor(cor)
            if (!all(dim(cor) == nsites)) 
                stop("matrix 'cor' must be square and of order 'length(nrec)'")
        }
        else {
            avcor <- as.vector(cor)
            if (length(avcor) != 1) 
                stop("'cor' must be either a matrix or a scalar")
            cor <- diag(1 - avcor, nsites) + avcor
        }
        cholcor <- try(chol(cor), silent = TRUE)
        if (class(cholcor) == "try-error") 
            stop("Correlation matrix is not positive definite")
    }
    if (is.null(index)) {
        integrator <- function(f, p) integrate(f, lower = 0, 
            upper = 1, p)$value
        index <- tryCatch(mapply(integrator, qfunc, para), error = function(...) NA)
        if (any(is.na(index))) 
            stop("integration failed: unable to compute index flood value at site(s) ", 
                which(is.na(index)))
    }
    else {
        index <- as.vector(index)
        if (!is.element(length(index), c(1, nsites))) 
            stop("vector 'index' must have length 1 or 'length(nrec)'")
        if (length(index) == 1) 
            index <- rep(index, length = nsites)
    }
    index1 <- isTRUE(all.equal(index, rep(1, length(index))))
    if (!is.character(fit) || length(fit) != 1) 
        stop("'fit' must be a character string")
    pelname <- paste("pel", fit, sep = "")
    quaname <- paste("qua", fit, sep = "")
    pf <- parent.frame()
    if (!exists(pelname, mode = "function", envir = pf)) 
        stop("function \"", pelname, "\" not found")
    if (!exists(quaname, mode = "function", envir = pf)) 
        stop("function \"", quaname, "\" not found")
    pelfit <- get(pelname, mode = "function", envir = pf)
    quafit <- get(quaname, mode = "function", envir = pf)
    if (any(f < 0 | f > 1)) 
        stop("probabilities in 'f' must be between 0 and 1")
    nq <- length(f)
    if (any(boundprob < 0 | boundprob > 1)) 
        stop("probabilities in 'boundprob' must be between 0 and 1")
    qflocal <- function(f, ...) f(...)
    re <- replicate(nrep, {
        if (nocorr) {
            ulist <- lapply(nrec, runif)
        }
        else {
            zmat <- matrix(rnorm(nsites * nmax), nsites, nmax)
            zmat <- crossprod(cholcor, zmat)
            zmat <- pnorm(zmat)
            ulist <- lapply(1:nsites, function(j) zmat[j, 1:nrec[j]])
        }
        perm <- sample(nsites)
        datlist <- mapply(qflocal, qfunc[perm], ulist, para[perm], 
            SIMPLIFY = FALSE)
        if (!index1) 
            datlist <- mapply("/", datlist, index[perm], SIMPLIFY = FALSE)
        xmom <- sapply(datlist, .samlmu, nmom = 5)
        sitemeans <- xmom[1, ]
        xmom[2, ] <- xmom[2, ]/xmom[1, ]
        xmom[1, ] <- 1
        rmom <- apply(xmom, 1, weighted.mean, w = nrec)
        rpara <- pelfit(rmom)
        rgc <- quafit(f, rpara)
        c(sitemeans, perm, rgc)
    })
    sim.sitemeans <- re[1:nsites, , drop = FALSE]
    sim.perm <- re[nsites + (1:nsites), , drop = FALSE]
    sim.rgc <- re[2 * nsites + (1:nq), , drop = FALSE]
    trueQ <- mapply(qflocal, qfunc, list(f), para, SIMPLIFY = FALSE)
    trueQ <- matrix(unlist(trueQ), ncol = nsites)
    true.asgc <- trueQ/matrix(index, nrow(trueQ), ncol(trueQ), 
        byrow = TRUE)
    my.quantile <- function(x, probs, ...) if (any(is.na(x))) 
        rep(NaN, length(probs))
    else quantile(x, probs, type = 6)
    sa <- sapply(seq(along = f), function(iq) {
        ou <- outer(sim.rgc[iq, , drop = FALSE], true.asgc[iq, 
            , drop = FALSE], "/")
        rr <- sqrt(mean((ou - 1)^2))
        qq <- my.quantile(ou, probs = boundprob)
        c(rr, qq)
    })
    rel.RMSE <- sa[1, ]
    rel.bounds <- t(sa[-1, ])
    dimnames(rel.bounds)[[2]] <- boundprob
    relbounds.rgc <- data.frame(f = f, rel.RMSE = rel.RMSE, rel.bound = rel.bounds)
    by.site <- lapply(1:nsites, function(isite) {
        true.asgc.permed <- true.asgc[, sim.perm[isite, ]]
        rgcratio <- sim.rgc/true.asgc.permed
        meanratio <- sim.sitemeans[isite, ]
        ratio <- rgcratio * matrix(meanratio, nq, nrep, byrow = TRUE)
        rel.RMSE <- sqrt(rowMeans((ratio - 1)^2))
        rel.bounds <- t(apply(ratio, 1, my.quantile, probs = boundprob))
        dimnames(rel.bounds)[[2]] <- boundprob
        data.frame(f = f, rel.RMSE = rel.RMSE, rel.bound = rel.bounds)
    })
    sim.rgcratio <- NULL
    if (save) {
        sim.rgcratio <- sim.rgc/true.asgc[, rep(1:nsites, length = nrep)]
        rownames(sim.rgcratio) <- f
    }
    out <- list(f = f, boundprob = boundprob, relbounds.rgc = relbounds.rgc, 
        relbounds.by.site = by.site, sim.rgcratio = sim.rgcratio)
    class(out) <- "regsimq"
    return(out)
}
<bytecode: 0x5600a4e8b6f8>
<environment: namespace:lmomRFA>
 --- function search by body ---
Function regsimq in namespace lmomRFA has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1