CRAN Package Check Results for Package survPen

Last updated on 2020-01-27 00:48:24 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.2.0 5.51 48.53 54.04 ERROR
r-devel-linux-x86_64-debian-gcc 1.2.0 3.96 501.49 505.45 OK
r-devel-linux-x86_64-fedora-clang 1.2.0 772.14 OK
r-devel-linux-x86_64-fedora-gcc 1.2.0 752.25 OK
r-devel-windows-ix86+x86_64 1.2.0 14.00 770.00 784.00 OK
r-devel-windows-ix86+x86_64-gcc8 1.2.0 13.00 672.00 685.00 OK
r-patched-linux-x86_64 1.2.0 4.89 610.12 615.01 OK
r-patched-solaris-x86 1.2.0 1713.00 OK
r-release-linux-x86_64 1.2.0 4.28 607.36 611.64 OK
r-release-windows-ix86+x86_64 1.2.0 8.00 578.00 586.00 OK
r-release-osx-x86_64 1.2.0 OK
r-oldrel-windows-ix86+x86_64 1.2.0 6.00 535.00 541.00 OK
r-oldrel-osx-x86_64 1.2.0 OK

Check Details

Version: 1.2.0
Check: examples
Result: ERROR
    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: 0x34436a8>
    <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
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2.0
Check: tests
Result: ERROR
     Running 'test_survPen.r' [2s/2s]
     Running 'testthat.R' [8s/9s]
    Running the tests in 'tests/test_survPen.r' failed.
    Complete output:
     > #--------------------------------------------------------------------------------------------------------------------------
     > # test code for survPen package
     > #--------------------------------------------------------------------------------------------------------------------------
     >
     >
     > library(survPen)
     > library(splines)
     > data(datCancer) # simulated dataset with 2000 individuals diagnosed with cervical cancer
     >
     >
     > cat("\n","______________________________________________________________________________________________","\n")
    
     ______________________________________________________________________________________________
     > cat("\n","survPen test code","\n")
    
     survPen test code
     > cat("\n","______________________________________________________________________________________________","\n")
    
     ______________________________________________________________________________________________
     >
     >
     > #-------------------------------------------------------- example 0
     > # Comparison between restricted cubic splines and penalized restricted cubic splines
     > cat("\n","______________________________________________________________________________________________","\n")
    
     ______________________________________________________________________________________________
     > cat("\n","example 0","\n")
    
     example 0
     > cat("\n","Comparison between restricted cubic splines and penalized restricted cubic splines","\n")
    
     Comparison between restricted cubic splines and penalized restricted cubic splines
     >
     >
     >
     > # unpenalized
     > f <- ~ns(fu,knots=c(0.25, 0.5, 1, 2, 4),Boundary.knots=c(0,5))
     >
     > mod <- survPen(f,data=datCancer,t1=fu,event=dead)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: survPen(f, data = datCancer, t1 = fu, event = dead)
    
     --- 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: 0x219e8a8>
     <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: survPen -> survPen.fit -> NR.beta
     Execution halted
    Running the tests in 'tests/testthat.R' failed.
    Complete output:
     > library(testthat)
     > library(survPen)
     >
     > test_check("survPen")
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2 at testthat/test_Newton.R#19: survPen.fit(model.c, data, form)
     where 3: eval(code, test_env)
     where 4: eval(code, test_env)
     where 5: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 6: doTryCatch(return(expr), name, parentenv, handler)
     where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 9: doTryCatch(return(expr), name, parentenv, handler)
     where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 11: tryCatchList(expr, classes, parentenv, handlers)
     where 12: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 13: test_code(NULL, exprs, env)
     where 14: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 15: force(code)
     where 16: doWithOneRestart(return(expr), restart)
     where 17: withOneRestart(expr, restarts[[1L]])
     where 18: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 19: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 20: FUN(X[[i]], ...)
     where 21: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 22: force(code)
     where 23: doWithOneRestart(return(expr), restart)
     where 24: withOneRestart(expr, restarts[[1L]])
     where 25: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 26: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 27: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 28: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 29: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 1. Error: (unknown) (@test_Newton.R#19) ------------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen.fit(model.c, data, form)
     2. survPen::NR.beta(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(-15,
     15)), data = datCancer)
     where 4: doTryCatch(return(expr), name, parentenv, handler)
     where 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 6: tryCatchList(expr, classes, parentenv, handlers)
     where 7: tryCatch(expr, error = function(e) {
     call <- conditionCall(e)
     if (!is.null(call)) {
     if (identical(call[[1L]], quote(doTryCatch)))
     call <- sys.call(-4L)
     dcall <- deparse(call)[1L]
     prefix <- paste("Error in", dcall, ": ")
     LONG <- 75L
     sm <- strsplit(conditionMessage(e), "\n")[[1L]]
     w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
     if (is.na(w))
     w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
     type = "b")
     if (w > LONG)
     prefix <- paste0(prefix, "\n ")
     }
     else prefix <- "Error : "
     msg <- paste0(prefix, conditionMessage(e), "\n")
     .Internal(seterrmessage(msg[1L]))
     if (!silent && isTRUE(getOption("show.error.messages"))) {
     cat(msg, file = outFile)
     .Internal(printDeferredWarnings())
     }
     invisible(structure(msg, class = "try-error", condition = e))
     })
     where 8 at testthat/test_error.R#53: try(survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(-15,
     15)), data = datCancer))
     where 9: eval(code, test_env)
     where 10: eval(code, test_env)
     where 11: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 12: doTryCatch(return(expr), name, parentenv, handler)
     where 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 14: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 15: doTryCatch(return(expr), name, parentenv, handler)
     where 16: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 17: tryCatchList(expr, classes, parentenv, handlers)
     where 18: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 19: test_code(NULL, exprs, env)
     where 20: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 21: force(code)
     where 22: doWithOneRestart(return(expr), restart)
     where 23: withOneRestart(expr, restarts[[1L]])
     where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 25: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 26: FUN(X[[i]], ...)
     where 27: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 28: force(code)
     where 29: doWithOneRestart(return(expr), restart)
     where 30: withOneRestart(expr, restarts[[1L]])
     where 31: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 32: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 33: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 34: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 35: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 36: test_check("survPen")
    
     --- 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: 0x42020b0>
     <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
     -- 2. Failure: limit case is ok (@test_error.R#56) ----------------------------
     inherits(mod1, "survPen") isn't true.
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(-20,
     20)), data = datCancer)
     where 4: doTryCatch(return(expr), name, parentenv, handler)
     where 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 6: tryCatchList(expr, classes, parentenv, handlers)
     where 7: tryCatch(expr, error = function(e) {
     call <- conditionCall(e)
     if (!is.null(call)) {
     if (identical(call[[1L]], quote(doTryCatch)))
     call <- sys.call(-4L)
     dcall <- deparse(call)[1L]
     prefix <- paste("Error in", dcall, ": ")
     LONG <- 75L
     sm <- strsplit(conditionMessage(e), "\n")[[1L]]
     w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
     if (is.na(w))
     w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
     type = "b")
     if (w > LONG)
     prefix <- paste0(prefix, "\n ")
     }
     else prefix <- "Error : "
     msg <- paste0(prefix, conditionMessage(e), "\n")
     .Internal(seterrmessage(msg[1L]))
     if (!silent && isTRUE(getOption("show.error.messages"))) {
     cat(msg, file = outFile)
     .Internal(printDeferredWarnings())
     }
     invisible(structure(msg, class = "try-error", condition = e))
     })
     where 8 at testthat/test_error.R#60: try(survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(-20,
     20)), data = datCancer))
     where 9: eval(code, test_env)
     where 10: eval(code, test_env)
     where 11: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 12: doTryCatch(return(expr), name, parentenv, handler)
     where 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 14: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 15: doTryCatch(return(expr), name, parentenv, handler)
     where 16: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 17: tryCatchList(expr, classes, parentenv, handlers)
     where 18: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 19: test_code(NULL, exprs, env)
     where 20: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 21: force(code)
     where 22: doWithOneRestart(return(expr), restart)
     where 23: withOneRestart(expr, restarts[[1L]])
     where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 25: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 26: FUN(X[[i]], ...)
     where 27: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 28: force(code)
     where 29: doWithOneRestart(return(expr), restart)
     where 30: withOneRestart(expr, restarts[[1L]])
     where 31: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 32: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 33: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 34: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 35: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 36: test_check("survPen")
    
     --- 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: 0x42020b0>
     <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
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- call from argument ---
     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
     }
     --- R stacktrace ---
     where 1: NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(55,
     45)), data = datCancer, max.it.beta = 50)
     where 4: doTryCatch(return(expr), name, parentenv, handler)
     where 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 6: tryCatchList(expr, classes, parentenv, handlers)
     where 7: tryCatch(expr, error = function(e) {
     call <- conditionCall(e)
     if (!is.null(call)) {
     if (identical(call[[1L]], quote(doTryCatch)))
     call <- sys.call(-4L)
     dcall <- deparse(call)[1L]
     prefix <- paste("Error in", dcall, ": ")
     LONG <- 75L
     sm <- strsplit(conditionMessage(e), "\n")[[1L]]
     w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
     if (is.na(w))
     w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
     type = "b")
     if (w > LONG)
     prefix <- paste0(prefix, "\n ")
     }
     else prefix <- "Error : "
     msg <- paste0(prefix, conditionMessage(e), "\n")
     .Internal(seterrmessage(msg[1L]))
     if (!silent && isTRUE(getOption("show.error.messages"))) {
     cat(msg, file = outFile)
     .Internal(printDeferredWarnings())
     }
     invisible(structure(msg, class = "try-error", condition = e))
     })
     where 8 at testthat/test_error.R#62: try(survPen(~tensor(fu, age), t1 = fu, event = dead, lambda = exp(c(55,
     45)), data = datCancer, max.it.beta = 50))
     where 9: eval(code, test_env)
     where 10: eval(code, test_env)
     where 11: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 12: doTryCatch(return(expr), name, parentenv, handler)
     where 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 14: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 15: doTryCatch(return(expr), name, parentenv, handler)
     where 16: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 17: tryCatchList(expr, classes, parentenv, handlers)
     where 18: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 19: test_code(NULL, exprs, env)
     where 20: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 21: force(code)
     where 22: doWithOneRestart(return(expr), restart)
     where 23: withOneRestart(expr, restarts[[1L]])
     where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 25: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 26: FUN(X[[i]], ...)
     where 27: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 28: force(code)
     where 29: doWithOneRestart(return(expr), restart)
     where 30: withOneRestart(expr, restarts[[1L]])
     where 31: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 32: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 33: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 34: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 35: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 36: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     Error in while (class(R) == "Error" | class(R) == "try-error") { :
     the condition has length > 1
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4: survPen(~tensor(fu, age), t1 = fu, event = dead, data = datCancer[1:6,
     ])
     where 5: doTryCatch(return(expr), name, parentenv, handler)
     where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 7: tryCatchList(expr, classes, parentenv, handlers)
     where 8: tryCatch(expr, error = function(e) {
     call <- conditionCall(e)
     if (!is.null(call)) {
     if (identical(call[[1L]], quote(doTryCatch)))
     call <- sys.call(-4L)
     dcall <- deparse(call)[1L]
     prefix <- paste("Error in", dcall, ": ")
     LONG <- 75L
     sm <- strsplit(conditionMessage(e), "\n")[[1L]]
     w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
     if (is.na(w))
     w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
     type = "b")
     if (w > LONG)
     prefix <- paste0(prefix, "\n ")
     }
     else prefix <- "Error : "
     msg <- paste0(prefix, conditionMessage(e), "\n")
     .Internal(seterrmessage(msg[1L]))
     if (!silent && isTRUE(getOption("show.error.messages"))) {
     cat(msg, file = outFile)
     .Internal(printDeferredWarnings())
     }
     invisible(structure(msg, class = "try-error", condition = e))
     })
     where 9 at testthat/test_error.R#64: try(survPen(~tensor(fu, age), t1 = fu, event = dead, data = datCancer[1:6,
     ]))
     where 10: eval(code, test_env)
     where 11: eval(code, test_env)
     where 12: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 13: doTryCatch(return(expr), name, parentenv, handler)
     where 14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 16: doTryCatch(return(expr), name, parentenv, handler)
     where 17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 18: tryCatchList(expr, classes, parentenv, handlers)
     where 19: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 20: test_code(NULL, exprs, env)
     where 21: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 22: force(code)
     where 23: doWithOneRestart(return(expr), restart)
     where 24: withOneRestart(expr, restarts[[1L]])
     where 25: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 26: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 27: FUN(X[[i]], ...)
     where 28: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 29: force(code)
     where 30: doWithOneRestart(return(expr), restart)
     where 31: withOneRestart(expr, restarts[[1L]])
     where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 33: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 34: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 35: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 36: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 37: test_check("survPen")
    
     --- 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: 0x42020b0>
     <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
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4: survPen(~tensor(fu, age), t1 = fu, event = event, data = don)
     where 5: doTryCatch(return(expr), name, parentenv, handler)
     where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 7: tryCatchList(expr, classes, parentenv, handlers)
     where 8: tryCatch(expr, error = function(e) {
     call <- conditionCall(e)
     if (!is.null(call)) {
     if (identical(call[[1L]], quote(doTryCatch)))
     call <- sys.call(-4L)
     dcall <- deparse(call)[1L]
     prefix <- paste("Error in", dcall, ": ")
     LONG <- 75L
     sm <- strsplit(conditionMessage(e), "\n")[[1L]]
     w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
     if (is.na(w))
     w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
     type = "b")
     if (w > LONG)
     prefix <- paste0(prefix, "\n ")
     }
     else prefix <- "Error : "
     msg <- paste0(prefix, conditionMessage(e), "\n")
     .Internal(seterrmessage(msg[1L]))
     if (!silent && isTRUE(getOption("show.error.messages"))) {
     cat(msg, file = outFile)
     .Internal(printDeferredWarnings())
     }
     invisible(structure(msg, class = "try-error", condition = e))
     })
     where 9 at testthat/test_error.R#76: try(survPen(~tensor(fu, age), t1 = fu, event = event, data = don))
     where 10: eval(code, test_env)
     where 11: eval(code, test_env)
     where 12: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 13: doTryCatch(return(expr), name, parentenv, handler)
     where 14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 16: doTryCatch(return(expr), name, parentenv, handler)
     where 17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 18: tryCatchList(expr, classes, parentenv, handlers)
     where 19: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 20: test_code(NULL, exprs, env)
     where 21: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 22: force(code)
     where 23: doWithOneRestart(return(expr), restart)
     where 24: withOneRestart(expr, restarts[[1L]])
     where 25: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 26: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 27: FUN(X[[i]], ...)
     where 28: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 29: force(code)
     where 30: doWithOneRestart(return(expr), restart)
     where 31: withOneRestart(expr, restarts[[1L]])
     where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 33: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 34: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 35: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 36: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 37: test_check("survPen")
    
     --- 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: 0x42020b0>
     <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
     -- 3. Error: Hessian perturbation at convergence (@test_error.R#79) -----------
     $ operator is invalid for atomic vectors
     Backtrace:
     1. testthat::expect_true(mod5$Hess.rho.modif)
     2. testthat::quasi_label(enquo(object), label, arg = "object")
     3. rlang::eval_bare(expr, quo_get_env(quo))
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4 at testthat/test_excess.R#10: survPen(~smf(fu), data = datCancer, t1 = fu, event = dead)
     where 5: eval(code, test_env)
     where 6: eval(code, test_env)
     where 7: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 8: doTryCatch(return(expr), name, parentenv, handler)
     where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 11: doTryCatch(return(expr), name, parentenv, handler)
     where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 13: tryCatchList(expr, classes, parentenv, handlers)
     where 14: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 15: test_code(NULL, exprs, env)
     where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 17: force(code)
     where 18: doWithOneRestart(return(expr), restart)
     where 19: withOneRestart(expr, restarts[[1L]])
     where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 22: FUN(X[[i]], ...)
     where 23: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 24: force(code)
     where 25: doWithOneRestart(return(expr), restart)
     where 26: withOneRestart(expr, restarts[[1L]])
     where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 28: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 31: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 32: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 4. Error: (unknown) (@test_excess.R#10) ------------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(~smf(fu), data = datCancer, t1 = fu, event = dead)
     2. survPen::NR.rho(...)
     3. survPen::survPen.fit(...)
     4. survPen::NR.beta(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4 at testthat/test_predictions.R#8: survPen(~smf(fu), t1 = fu, event = dead, data = datCancer)
     where 5: eval(code, test_env)
     where 6: eval(code, test_env)
     where 7: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 8: doTryCatch(return(expr), name, parentenv, handler)
     where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 11: doTryCatch(return(expr), name, parentenv, handler)
     where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 13: tryCatchList(expr, classes, parentenv, handlers)
     where 14: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 15: test_code(NULL, exprs, env)
     where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 17: force(code)
     where 18: doWithOneRestart(return(expr), restart)
     where 19: withOneRestart(expr, restarts[[1L]])
     where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 22: FUN(X[[i]], ...)
     where 23: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 24: force(code)
     where 25: doWithOneRestart(return(expr), restart)
     where 26: withOneRestart(expr, restarts[[1L]])
     where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 28: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 31: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 32: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 5. Error: (unknown) (@test_predictions.R#8) --------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(~smf(fu), t1 = fu, event = dead, data = datCancer)
     2. survPen::NR.rho(...)
     3. survPen::survPen.fit(...)
     4. survPen::NR.beta(...)
    
     _______________________________________________________________________________________
    
     Beginning smoothing parameter estimation via LAML optimization
     ______________________________________________________________________________________
    
     --------------------
     Initial calculation
     -------------------
    
     ---------------------------------------------------------------------------------------
     Beginning regression parameter estimation
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4 at testthat/test_random_effects.R#51: survPen(~smf(fu) + rd(cluster), data = don, t1 = fu, event = dead,
     detail.beta = TRUE, detail.rho = TRUE)
     where 5: eval(code, test_env)
     where 6: eval(code, test_env)
     where 7: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 8: doTryCatch(return(expr), name, parentenv, handler)
     where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 11: doTryCatch(return(expr), name, parentenv, handler)
     where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 13: tryCatchList(expr, classes, parentenv, handlers)
     where 14: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 15: test_code(NULL, exprs, env)
     where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 17: force(code)
     where 18: doWithOneRestart(return(expr), restart)
     where 19: withOneRestart(expr, restarts[[1L]])
     where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 22: FUN(X[[i]], ...)
     where 23: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 24: force(code)
     where 25: doWithOneRestart(return(expr), restart)
     where 26: withOneRestart(expr, restarts[[1L]])
     where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 28: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 31: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 32: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 6. Error: (unknown) (@test_random_effects.R#51) ----------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(...)
     2. survPen::NR.rho(...)
     3. survPen::survPen.fit(...)
     4. survPen::NR.beta(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3 at testthat/test_smf.R#12: survPen(f.ns, data = datCancer, t1 = fu, event = dead)
     where 4: eval(code, test_env)
     where 5: eval(code, test_env)
     where 6: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 7: doTryCatch(return(expr), name, parentenv, handler)
     where 8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 9: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 10: doTryCatch(return(expr), name, parentenv, handler)
     where 11: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 12: tryCatchList(expr, classes, parentenv, handlers)
     where 13: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 14: test_code(NULL, exprs, env)
     where 15: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 16: force(code)
     where 17: doWithOneRestart(return(expr), restart)
     where 18: withOneRestart(expr, restarts[[1L]])
     where 19: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 20: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 21: FUN(X[[i]], ...)
     where 22: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 23: force(code)
     where 24: doWithOneRestart(return(expr), restart)
     where 25: withOneRestart(expr, restarts[[1L]])
     where 26: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 27: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 28: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 29: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 30: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 31: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 7. Error: (unknown) (@test_smf.R#12) ---------------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(f.ns, data = datCancer, t1 = fu, event = dead)
     2. survPen::survPen.fit(...)
     3. survPen::NR.beta(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4 at testthat/test_tensor.R#37: survPen(~tensor(fu, age), data = datCancer, t1 = fu, event = dead)
     where 5: eval(code, test_env)
     where 6: eval(code, test_env)
     where 7: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 8: doTryCatch(return(expr), name, parentenv, handler)
     where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 11: doTryCatch(return(expr), name, parentenv, handler)
     where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 13: tryCatchList(expr, classes, parentenv, handlers)
     where 14: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 15: test_code(NULL, exprs, env)
     where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 17: force(code)
     where 18: doWithOneRestart(return(expr), restart)
     where 19: withOneRestart(expr, restarts[[1L]])
     where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 22: FUN(X[[i]], ...)
     where 23: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 24: force(code)
     where 25: doWithOneRestart(return(expr), restart)
     where 26: withOneRestart(expr, restarts[[1L]])
     where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 28: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 31: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 32: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 8. Error: (unknown) (@test_tensor.R#37) ------------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(...)
     2. survPen::NR.rho(...)
     3. survPen::survPen.fit(...)
     4. survPen::NR.beta(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     survPen
     --- call from context ---
     NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
     where 3: NR.rho(build, rho.ini = rho.ini, data = data, formula = formula,
     max.it.beta = max.it.beta, max.it.rho = max.it.rho, beta.ini = beta.ini,
     detail.rho = detail.rho, detail.beta = detail.beta, nb.smooth = nb.smooth,
     tol.beta = tol.beta, tol.rho = tol.rho, step.max = step.max,
     method = method)
     where 4 at testthat/tests_by.R#11: survPen(~smf(fu, by = age), data = datCancer, t1 = fu, event = dead)
     where 5: eval(code, test_env)
     where 6: eval(code, test_env)
     where 7: withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error)
     where 8: doTryCatch(return(expr), name, parentenv, handler)
     where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
     where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
     where 11: doTryCatch(return(expr), name, parentenv, handler)
     where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
     names[nh], parentenv, handlers[[nh]])
     where 13: tryCatchList(expr, classes, parentenv, handlers)
     where 14: tryCatch(withCallingHandlers({
     eval(code, test_env)
     if (!handled && !is.null(test)) {
     skip_empty()
     }
     }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
     message = handle_message, error = handle_error), error = handle_fatal,
     skip = function(e) {
     })
     where 15: test_code(NULL, exprs, env)
     where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
     where 17: force(code)
     where 18: doWithOneRestart(return(expr), restart)
     where 19: withOneRestart(expr, restarts[[1L]])
     where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 21: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
     {
     reporter$start_file(basename(path))
     lister$start_file(basename(path))
     source_file(path, new.env(parent = env), chdir = TRUE,
     wrap = wrap)
     reporter$.end_context()
     reporter$end_file()
     })
     where 22: FUN(X[[i]], ...)
     where 23: lapply(paths, test_file, env = env, reporter = current_reporter,
     start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
     where 24: force(code)
     where 25: doWithOneRestart(return(expr), restart)
     where 26: withOneRestart(expr, restarts[[1L]])
     where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
     where 28: with_reporter(reporter = current_reporter, results <- lapply(paths,
     test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
     load_helpers = FALSE, wrap = wrap))
     where 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 30: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
     ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
     wrap = wrap)
     where 31: test_package_dir(package = package, test_path = test_path, filter = filter,
     reporter = reporter, ..., stop_on_failure = stop_on_failure,
     stop_on_warning = stop_on_warning, wrap = wrap)
     where 32: test_check("survPen")
    
     --- 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: 0x42020b0>
     <environment: namespace:survPen>
     --- function search by body ---
     Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 9. Error: (unknown) (@tests_by.R#11) ---------------------------------------
     the condition has length > 1
     Backtrace:
     1. survPen::survPen(...)
     2. survPen::NR.rho(...)
     3. survPen::survPen.fit(...)
     4. survPen::NR.beta(...)
    
     == testthat results ===========================================================
     [ OK: 13 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 9 ]
     1. Error: (unknown) (@test_Newton.R#19)
     2. Failure: limit case is ok (@test_error.R#56)
     3. Error: Hessian perturbation at convergence (@test_error.R#79)
     4. Error: (unknown) (@test_excess.R#10)
     5. Error: (unknown) (@test_predictions.R#8)
     6. Error: (unknown) (@test_random_effects.R#51)
     7. Error: (unknown) (@test_smf.R#12)
     8. Error: (unknown) (@test_tensor.R#37)
     9. Error: (unknown) (@tests_by.R#11)
    
     Error: testthat unit tests failed
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
     ...
    --- re-building 'survival_analysis_with_survPen.Rmd' using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    survPen
     --- call from context ---
    NR.beta(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
     --- 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(build, beta.ini, detail.beta = detail.beta, max.it.beta = max.it.beta,
     tol.beta = tol.beta)
    where 2: survPen.fit(build, data = data, formula = formula, max.it.beta = max.it.beta,
     beta.ini = beta.ini, detail.beta = detail.beta, method = method,
     tol.beta = tol.beta)
    where 3: survPen(f.cst, data = datCancer, t1 = fu, event = dead)
    where 4: eval(expr, envir, enclos)
    where 5: eval(expr, envir, enclos)
    where 6: withVisible(eval(expr, envir, enclos))
    where 7: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 8: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 9: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 10: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 11: evaluate::evaluate(...)
    where 12: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 13: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 14: block_exec(params)
    where 15: call_block(x)
    where 16: process_group.block(group)
    where 17: process_group(group)
    where 18: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 19: process_file(text, output)
    where 20: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
    where 21: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     output_dir = getwd(), ...)
    where 22: vweave_rmarkdown(...)
    where 23: engine$weave(file, quiet = quiet, encoding = enc)
    where 24: doTryCatch(return(expr), name, parentenv, handler)
    where 25: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 26: tryCatchList(expr, classes, parentenv, handlers)
    where 27: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
     outputs <- c(outputs, output)
    }, error = function(e) {
     thisOK <<- FALSE
     fails <<- c(fails, file)
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 28: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/survPen.Rcheck/vign_test/survPen",
     ser_elibs = "/tmp/RtmpjLiMut/file131d1f463087.rds")
    
     --- 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: 0x3a358e0>
    <environment: namespace:survPen>
     --- function search by body ---
    Function NR.beta in namespace survPen has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 180-182 (survival_analysis_with_survPen.Rmd)
    Error: processing vignette 'survival_analysis_with_survPen.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building 'survival_analysis_with_survPen.Rmd'
    
    SUMMARY: processing the following file failed:
     'survival_analysis_with_survPen.Rmd'
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang