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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: aapc
> ### Title: Average annual per cent change in segmented trend analysis
> ### Aliases: aapc
> ### Keywords: regression
> 
> ### ** Examples
> 
> set.seed(12)
> x<-1:20
> y<-2-.5*x+.7*pmax(x-9,0)-.8*pmax(x-15,0)+rnorm(20)*.3
> o<-lm(y~x)
> os<-segmented(o, psi=c(5,12))
> aapc(os)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
segmented
 --- call from context --- 
slope(ogg, parm)
 --- call from argument --- 
if (class(covv) != "try-error") {
    cov.ok <- covv[ind, ind]
    cov.out <- M %*% cov.ok %*% t(M)
    se.out <- sqrt(diag(cov.out))
    k <- if ("lm" %in% class(ogg)) 
        abs(qt((1 - conf.level)/2, df = ogg$df.residual))
    else abs(qnorm((1 - conf.level)/2))
    k <- k * se.out
    ris <- cbind(cof.out, se.out, (cof.out/se.out), (cof.out - 
        k), (cof.out + k))
} else {
    ris <- cbind(cof.out, NA, NA, NA, NA)
}
 --- R stacktrace ---
where 1: slope(ogg, parm)
where 2: aapc(os)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (ogg, parm, conf.level = 0.95, rev.sgn = FALSE, APC = FALSE, 
    .vcov = NULL, ..., digits = max(4, getOption("digits") - 
        2)) 
{
    f.U <- function(nomiU, term = NULL) {
        k <- length(nomiU)
        nomiUsenzaU <- strsplit(nomiU, "\\.")
        nomiU.ok <- vector(length = k)
        for (i in 1:k) {
            nomi.i <- nomiUsenzaU[[i]][-1]
            if (length(nomi.i) > 1) 
                nomi.i <- paste(nomi.i, collapse = ".")
            nomiU.ok[i] <- nomi.i
        }
        if (!is.null(term)) 
            nomiU.ok <- (1:k)[nomiU.ok %in% term]
        return(nomiU.ok)
    }
    covv <- try(vcov(ogg, ...), silent = TRUE)
    covv <- if (is.null(.vcov)) 
        vcov(ogg, ...)
    else .vcov
    if (!all(dim(covv) == c(length(coef(ogg)), length(coef(ogg))))) 
        stop("Incorrect dimension of cov matrix", call. = FALSE)
    nomepsi <- rownames(ogg$psi)
    nomeU <- ogg$nameUV$U
    nomeZ <- ogg$nameUV$Z
    if (missing(parm)) {
        nomeZ <- ogg$nameUV$Z
        if (length(rev.sgn) == 1) 
            rev.sgn <- rep(rev.sgn, length(nomeZ))
    }
    else {
        if (!all(parm %in% ogg$nameUV$Z)) {
            stop("invalid parm")
        }
        else {
            nomeZ <- parm
        }
    }
    if (length(rev.sgn) != length(nomeZ)) 
        rev.sgn <- rep(rev.sgn, length.out = length(nomeZ))
    nomi <- names(coef(ogg))
    nomi <- nomi[-match(nomepsi, nomi)]
    index <- vector(mode = "list", length = length(nomeZ))
    for (i in 1:length(nomeZ)) {
        nomiPsi <- grep(paste(".", nomeZ[i], sep = ""), ogg$nameUV$V, 
            value = TRUE)
        psii <- ogg$psi[nomiPsi, "Est."]
        nomiU <- grep(paste(".", nomeZ[i], sep = ""), ogg$nameUV$U, 
            value = TRUE)
        id.cof.U <- match(nomiU, names(ogg$coef))
        index[[i]] <- c(match(nomeZ[i], nomi), id.cof.U)
    }
    Ris <- list()
    rev.sgn <- rep(rev.sgn, length.out = length(nomeZ))
    for (i in 1:length(index)) {
        ind <- as.numeric(na.omit(unlist(index[[i]])))
        M <- matrix(1, length(ind), length(ind))
        M[row(M) < col(M)] <- 0
        cof <- coef(ogg)[ind]
        cof.out <- M %*% cof
        if (class(covv) != "try-error") {
            cov.ok <- covv[ind, ind]
            cov.out <- M %*% cov.ok %*% t(M)
            se.out <- sqrt(diag(cov.out))
            k <- if ("lm" %in% class(ogg)) 
                abs(qt((1 - conf.level)/2, df = ogg$df.residual))
            else abs(qnorm((1 - conf.level)/2))
            k <- k * se.out
            ris <- cbind(cof.out, se.out, (cof.out/se.out), (cof.out - 
                k), (cof.out + k))
        }
        else {
            ris <- cbind(cof.out, NA, NA, NA, NA)
        }
        cin <- paste("CI", "(", conf.level * 100, "%", ")", c(".l", 
            ".u"), sep = "")
        if (!nomeZ[i] %in% nomi) {
            ris <- rbind(c(0, rep(NA, (ncol(ris) - 1))), ris)
        }
        if (rev.sgn[i]) {
            ris <- cbind(-ris[nrow(ris):1, 1], ris[nrow(ris):1, 
                2], -ris[nrow(ris):1, 3], -ris[nrow(ris):1, 5], 
                -ris[nrow(ris):1, 4])
        }
        nomeT <- if ("lm" %in% class(ogg)) 
            "t value"
        else "z value"
        dimnames(ris) <- list(paste("slope", 1:nrow(ris), sep = ""), 
            c("Est.", "St.Err.", nomeT, cin[1], cin[2]))
        if (APC) 
            ris <- 100 * (exp(ris[, c(1, 4, 5)]) - 1)
        Ris[[nomeZ[i]]] <- signif(ris, digits)
    }
    Ris
}
<bytecode: 0x26625b0>
<environment: namespace:segmented>
 --- function search by body ---
Function slope in namespace segmented has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1