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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: pchreg
> ### Title: Piecewise Constant Hazards Models
> ### Aliases: pchreg
> ### Keywords: survival models regression
> 
> ### ** Examples
> 
> 
>   # using simulated data
>   
>   n <- 1000
>   x <- runif(n)
>   time <- rnorm(n, 1 + x, 1 + x)
>   cens <- rnorm(n,2,2)
>   y <- pmin(time,cens) # censored variable
>   d <- (time <= cens) # indicator of the event
> 
>   model <- pchreg(Surv(y,d) ~ x, breaks = 20)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
pch
 --- call from context --- 
pois.newton(beta0, pois.loglik, tol = 1e-05, maxit = 10 * (1 + 
    q), safeit = safeit, d = d, x = x, w = w, off = off, zeror = zeror)
 --- call from argument --- 
if (class(H1) != "try-error") {
    if (alg == "gs") {
        alg <- "nr"
        eps <- 1
    }
    delta <- chol2inv(H1) %*% g
} else {
    if (alg == "nr") {
        alg <- "gs"
        eps <- 1
    }
    delta <- g
}
 --- R stacktrace ---
where 1: pois.newton(beta0, pois.loglik, tol = 1e-05, maxit = 10 * (1 + 
    q), safeit = safeit, d = d, x = x, w = w, off = off, zeror = zeror)
where 2: poisfit(dj, xj, wj, yj_zj)
where 3: pch.fit(z, y, d, x, w, breaks)
where 4: pchreg(Surv(y, d) ~ x, breaks = 20)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (start, f, tol = 1e-05, maxit = 200, safeit = 0, ...) 
{
    f0 <- f(start, ..., deriv = 2)
    g <- attr(f0, "gradient")
    h <- attr(f0, "hessian")
    conv <- FALSE
    eps <- 1
    alg <- "gs"
    for (i in 1:maxit) {
        if (conv | max(abs(g)) < tol) {
            break
        }
        if (i > safeit) {
            H1 <- try(chol(h), silent = TRUE)
            if (class(H1) != "try-error") {
                if (alg == "gs") {
                  alg <- "nr"
                  eps <- 1
                }
                delta <- chol2inv(H1) %*% g
            }
            else {
                if (alg == "nr") {
                  alg <- "gs"
                  eps <- 1
                }
                delta <- g
            }
        }
        else {
            delta <- g
        }
        f1 <- Inf
        while (f1 > f0) {
            new.start <- start - delta * eps
            if (max(abs(delta * eps)) < tol) {
                conv <- TRUE
                break
            }
            f1 <- try(f(new.start, ..., deriv = 0), silent = TRUE)
            eps <- eps * 0.5
            if (class(f1) == "try-error" || is.na(f1)) {
                f1 <- Inf
            }
        }
        if (conv | f0 - f1 < tol) {
            break
        }
        f1 <- f(new.start, ..., deriv = 2)
        g1 <- attr(f1, "gradient")
        h1 <- attr(f1, "hessian")
        start <- new.start
        f0 <- f1
        g <- g1
        h <- h1
        eps <- min(eps * 10, 1)
    }
    list(estimate = start, n.it = i, minimum = as.numeric(f0), 
        gradient = g, hessian = h)
}
<bytecode: 0x55a38aa947b8>
<environment: namespace:pch>
 --- function search by body ---
Function pois.newton in namespace pch has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1