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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: NR.beta
> ### Title: Inner Newton-Raphson algorithm for regression parameters
> ###   estimation
> ### Aliases: NR.beta
> 
> ### ** Examples
> 
> 
> library(survPen)
> 
> # standard spline of time with 4 knots
> 
> data <- data.frame(time=seq(0,5,length=100),event=1,t0=0)
> 
> form <- ~ smf(time,knots=c(0,1,3,5))
> 
> t1 <- eval(substitute(time), data)
> t0 <- eval(substitute(t0), data)
> event <- eval(substitute(event), data)
> 	
> # Setting up the model before fitting
> model.c <- model.cons(form,lambda=0,data.spec=data,t1=t1,t1.name="time",
+ t0=rep(0,100),t0.name="t0",event=event,event.name="event",
+ expected=NULL,expected.name=NULL,type="overall",n.legendre=20,
+ cl="survPen(form,data,t1=time,event=event)")
>  
> # Estimating the regression parameters at given smoothing parameter (here lambda=0)
> Newton1 <- NR.beta(model.c,beta.ini=rep(0,4),detail.beta=TRUE)
--------------------------------------------------------------------------------------- 
 Beginning regression parameter estimation 
 
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
survPen
 --- call from context --- 
NR.beta(model.c, beta.ini = rep(0, 4), detail.beta = TRUE)
 --- call from argument --- 
if (class(R) == "Error" | class(R) == "try-error") {
    u = 0.001
    cpt.while <- 0
    while (class(R) == "Error" | class(R) == "try-error") {
        if (cpt.while > 100) {
            stop("message NR.beta: did not succeed in inverting Hessian at iteration ", 
                k)
        }
        R <- try(chol(neg.Hess + u * diag(p)), silent = TRUE)
        u <- 5 * u
        cpt.while <- cpt.while + 1
    }
    if (detail.beta) {
        cat("beta Hessian perturbation, ", cpt.while, "iterations", 
            "\n", "\n")
    }
}
 --- R stacktrace ---
where 1: NR.beta(model.c, beta.ini = rep(0, 4), detail.beta = TRUE)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (build, beta.ini, detail.beta, max.it.beta = 200, tol.beta = 1e-04) 
{
    type <- build$type
    X <- build$X
    T.X <- build$T.X
    X.GL <- build$X.GL
    T.X.GL <- build$T.X.GL
    X.GL.w.tm <- build$X.GL.w.tm
    event <- build$event
    eventX <- build$eventX
    expected <- build$expected
    eventXexpected <- build$eventXexpected
    leg <- build$leg
    n.legendre <- build$n.legendre
    t1 <- build$t1
    t0 <- build$t0
    tm <- build$tm
    S <- build$S
    p <- build$p
    k = 1
    ll.pen = 100
    ll.pen.old = 1
    if (length(beta.ini) == 1) 
        beta.ini <- rep(beta.ini, p)
    if (length(beta.ini) != p) 
        stop("message NR.beta: the length of beta.ini does not equal the number of regression parameters")
    betaold <- beta.ini
    beta1 <- betaold
    if (detail.beta) {
        cat("---------------------------------------------------------------------------------------", 
            "\n", "Beginning regression parameter estimation", 
            "\n", "\n")
    }
    while (abs(ll.pen - ll.pen.old) > tol.beta | any(abs((beta1 - 
        betaold)/betaold) > tol.beta)) {
        if (k > max.it.beta) {
            stop("message NR.beta: Ran out of iterations (", 
                k, "), and did not converge ")
        }
        if (k >= 2) {
            ll.pen.old <- ll.pen
            betaold <- beta1
        }
        predold = as.vector(X %*% betaold)
        ftold = as.vector(exp(predold))
        haz.GL.old <- lapply(1:n.legendre, function(i) as.vector(exp(X.GL[[i]] %*% 
            betaold)))
        deriv.list <- lapply(1:n.legendre, function(i) X.GL.w.tm[[i]] * 
            haz.GL.old[[i]])
        f.first <- Reduce("+", deriv.list)
        if (type == "net") {
            grad.unpen.beta <- colSums(-f.first + (eventX * ftold)/(ftold + 
                expected))
        }
        else {
            grad.unpen.beta <- colSums(-f.first + eventX)
        }
        grad <- grad.unpen.beta - as.vector(S %*% betaold)
        deriv.2.list <- lapply(1:n.legendre, function(i) T.X.GL[[i]] %*% 
            (deriv.list[[i]]))
        f.second <- Reduce("+", deriv.2.list)
        if (type == "net") {
            Hess.unpen <- -f.second + T.X %*% (eventXexpected * 
                ftold/(ftold + expected)^2)
        }
        else {
            Hess.unpen <- -f.second
        }
        Hess <- Hess.unpen - S
        neg.Hess <- -Hess
        R <- try(chol(neg.Hess), silent = TRUE)
        if (class(R) == "Error" | class(R) == "try-error") {
            u = 0.001
            cpt.while <- 0
            while (class(R) == "Error" | class(R) == "try-error") {
                if (cpt.while > 100) {
                  stop("message NR.beta: did not succeed in inverting Hessian at iteration ", 
                    k)
                }
                R <- try(chol(neg.Hess + u * diag(p)), silent = TRUE)
                u <- 5 * u
                cpt.while <- cpt.while + 1
            }
            if (detail.beta) {
                cat("beta Hessian perturbation, ", cpt.while, 
                  "iterations", "\n", "\n")
            }
        }
        neg.inv.Hess <- chol2inv(R)
        integral <- lapply(1:n.legendre, function(i) haz.GL.old[[i]] * 
            leg$weights[i])
        integral <- tm * Reduce("+", integral)
        if (type == "net") {
            ll.unpenold <- sum(-integral + event * log(ftold + 
                expected))
        }
        else {
            ll.unpenold <- sum(-integral + event * predold)
        }
        ll.pen.old <- ll.unpenold - as.numeric(t(betaold) %*% 
            S %*% betaold) * 0.5
        if (is.nan(ll.pen.old)) 
            stop("message NR.beta: convergence issues, cannot evaluate log-likelihood")
        pas <- as.vector(neg.inv.Hess %*% grad)
        beta1 <- betaold + pas
        pred1 <- as.vector(X %*% beta1)
        ft1 = as.vector(exp(pred1))
        haz.GL <- lapply(1:n.legendre, function(i) as.vector(exp(X.GL[[i]] %*% 
            beta1)))
        integral <- lapply(1:n.legendre, function(i) haz.GL[[i]] * 
            leg$weights[i])
        integral <- tm * Reduce("+", integral)
        if (type == "net") {
            ll.unpen <- sum(-integral + event * log(ft1 + expected))
        }
        else {
            ll.unpen <- sum(-integral + event * pred1)
        }
        ll.pen <- ll.unpen - as.numeric(t(beta1) %*% S %*% beta1) * 
            0.5
        if (is.nan(ll.pen)) {
            ll.pen <- ll.pen.old - 1
        }
        if (ll.pen < ll.pen.old - 0.001) {
            cpt.beta <- 1
            while (ll.pen < ll.pen.old - 0.001) {
                if (cpt.beta > 52) 
                  stop("message NR.beta: step has been divided by two 52 times in a row, Log-likelihood could not be optimized")
                cpt.beta <- cpt.beta + 1
                pas <- 0.5 * pas
                beta1 <- betaold + pas
                pred1 <- as.vector(X %*% beta1)
                ft1 = as.vector(exp(pred1))
                haz.GL <- lapply(1:n.legendre, function(i) as.vector(exp(X.GL[[i]] %*% 
                  beta1)))
                integral <- lapply(1:n.legendre, function(i) haz.GL[[i]] * 
                  leg$weights[i])
                integral <- tm * Reduce("+", integral)
                if (type == "net") {
                  ll.unpen <- sum(-integral + event * log(ft1 + 
                    expected))
                }
                else {
                  ll.unpen <- sum(-integral + event * pred1)
                }
                ll.pen <- ll.unpen - as.numeric(t(beta1) %*% 
                  S %*% beta1) * 0.5
                if (is.nan(ll.pen)) {
                  ll.pen <- ll.pen.old - 1
                }
            }
        }
        if (detail.beta) {
            cat("iter beta: ", k, "\n", "betaold= ", round(betaold, 
                4), "\n", "beta= ", round(beta1, 4), "\n", "abs((beta-betaold)/betaold)= ", 
                round(abs((beta1 - betaold)/betaold), 5), "\n", 
                "ll.pen.old= ", round(ll.pen.old, 4), "\n", "ll.pen= ", 
                round(ll.pen, 4), "\n", "ll.pen-ll.pen.old= ", 
                round(ll.pen - ll.pen.old, 5), "\n", "\n")
        }
        k = k + 1
    }
    if (detail.beta) {
        cat("\n", "Beta optimization ok, ", k - 1, "iterations", 
            "\n", "--------------------------------------------------------------------------------------", 
            "\n")
    }
    list(beta = beta1, ll.unpen = ll.unpen, ll.pen = ll.pen, 
        haz.GL = haz.GL, iter.beta = k - 1)
}
<bytecode: 0x3e7d7d0>
<environment: namespace:survPen>
 --- function search by body ---
Function NR.beta in namespace survPen has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(R) == "Error" | class(R) == "try-error") { : 
  the condition has length > 1
Calls: NR.beta
Execution halted