Running ‘testthat.R’ [38s/277s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(icmstate)
  > 
  > test_check("icmstate")
  [1] "Frydman Support"
  [1] "MSM Support"
  
   *** caught segfault ***
  address 0x1, cause 'memory not mapped'
  
  Traceback:
   1: Ccall.msm(params, do.what = "lik", ...)
   2: fn(par, ...)
   3: (function (par) fn(par, ...))(c(qbase = -3.06196393627199, qbase = -1.6756695751521, qbase = -1.4667876541959))
   4: optim(method = "BFGS", control = list(), par = c(qbase = -3.06196393627199, qbase = -1.6756695751521, qbase = -1.4667876541959), fn = function (params,     ...) {    assign("nliks", get("nliks", msm.globals) + 1, envir = msm.globals)    args <- list(...)    w <- args$msmdata$subject.weights    if (!is.null(w)) {        lik <- Ccall.msm(params, do.what = "lik.subj", ...)        sum(w * lik)    }    else Ccall.msm(params, do.what = "lik", ...)}, hessian = TRUE, gr = function (params, ...) {    w <- list(...)$msmdata$subject.weights    if (!is.null(w)) {        deriv <- Ccall.msm(params, do.what = "deriv.subj", ...)        apply(w * deriv, 2, sum)    }    else Ccall.msm(params, do.what = "deriv", ...)}, msmdata = list(mf = list(`(subject)` = c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5), `(state)` = c(1, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 1, 3), `(time)` = c(0, 0.813481943681836, 0, 7.9621127679944, 11.3083713456988, 0, 4.29615335352719, 0, 0.662206339277327, 4.34080645274371, 4.99749264931306, 0, 0.724425864871591, 4.28927130056545), `(obstype)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),     `(obstrue)` = c(1, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 1, 3),     `(obs)` = 1:14, `(pcomb)` = c(NA, 1L, NA, 2L, 3L, NA, 4L,     NA, 5L, 6L, 7L, NA, 8L, 9L)), mf.agg = list(`(subject)` = c(4, 4, 5, 1, 2, 5, 4, 3, 2), `(fromstate)` = c(2, 1, 1, 1, 1, 1, 2, 1, 1), `(time)` = c(4.34080645274371, 0, 0, 0, 7.9621127679944, 0.724425864871591, 0.662206339277327, 0, 0), `(obstype)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1), `(obstrue)` = c(2, 1, 1, 1, 1, 1, 2, 1, 1), `(obs)` = c(11L, 9L, 13L, 2L, 5L, 14L, 10L, 7L, 4L), `(tostate)` = c(3, 2, 1, 3, 3, 3, 2, 3, 1), `(timelag)` = c(0.656686196569353, 0.662206339277327, 0.724425864871591, 0.813481943681836, 3.34625857770443, 3.56484543569386, 3.67860011346638, 4.29615335352719, 7.9621127679944), `(nocc)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1), `(whicha)` = 1:9, `(noccsum)` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_)), mm.cov = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), mm.cov.agg = c(1, 1, 1, 1, 1, 1, 1, 1, 1), mm.mcov = NULL,     mm.hcov = NULL, mm.icov = NULL, subject.weights = NULL),     qmodel = list(nstates = 3L, iso = 4, perm = c(1, 2, 3), qperm = 1:3,         npars = 3, imatrix = c(0, 0, 0, 1, 0, 0, 1, 1, 0), qmatrix = c(-0.233978505697303,         0, 0, 0.0467957011394606, -0.230665272945204, 0, 0.187182804557843,         0.230665272945204, 0), inits = c(0.0467957011394606,         0.187182804557843, 0.230665272945204), constr = 1:3,         ndpars = 3L, expm = 1), qcmodel = list(npars = 0, ncovs = 0,         ndpars = 0), cmodel = list(ncens = 0, censor = NULL,         states = NULL, states_list = NULL, index = NULL), hmodel = list(        hidden = FALSE, models = c(0, 0, 0), nipars = 0, nicoveffs = 0,         totpars = 0, ncoveffs = 0, ematrix = FALSE), paramdata = list(        inits = c(qbase = -3.06196393627199, qbase = -1.6756695751521,         qbase = -1.4667876541959), plabs = c("qbase", "qbase",         "qbase"), allinits = c(qbase = -3.06196393627199, qbase = -1.6756695751521,         qbase = -1.4667876541959), hmmpars = integer(0), fixed = FALSE,         fixedpars = integer(0), optpars = 1:3, auxpars = integer(0),         constr = c(1, 2, 3), npars = 3, duppars = integer(0),         nfix = 0L, nopt = 3L, ndup = 0L, ranges = c(0, 0, 0,         Inf, Inf, Inf), params = c(qbase = -3.06196393627199,         qbase = -1.6756695751521, qbase = -1.4667876541959)))
   5: do.call("optim", optim.args)
   6: msm.optim.optim(p = list(inits = c(qbase = -3.06196393627199, qbase = -1.6756695751521, qbase = -1.4667876541959), plabs = c("qbase", "qbase", "qbase"), allinits = c(qbase = -3.06196393627199, qbase = -1.6756695751521, qbase = -1.4667876541959), hmmpars = integer(0), fixed = FALSE,     fixedpars = integer(0), optpars = 1:3, auxpars = integer(0),     constr = c(1, 2, 3), npars = 3, duppars = integer(0), nfix = 0L,     nopt = 3L, ndup = 0L, ranges = c(0, 0, 0, Inf, Inf, Inf),     params = c(qbase = -3.06196393627199, qbase = -1.6756695751521,     qbase = -1.4667876541959)), gr = function (params, ...) {    w <- list(...)$msmdata$subject.weights    if (!is.null(w)) {        deriv <- Ccall.msm(params, do.what = "deriv.subj", ...)        apply(w * deriv, 2, sum)    }    else Ccall.msm(params, do.what = "deriv", ...)}, hessian = TRUE, msmdata = list(mf = list(`(subject)` = c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5), `(state)` = c(1, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 1, 3), `(time)` = c(0, 0.813481943681836, 0, 7.9621127679944, 11.3083713456988, 0, 4.29615335352719, 0, 0.662206339277327, 4.34080645274371, 4.99749264931306, 0, 0.724425864871591, 4.28927130056545), `(obstype)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), `(obstrue)` = c(1, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 1, 3), `(obs)` = 1:14, `(pcomb)` = c(NA, 1L, NA, 2L, 3L, NA, 4L, NA, 5L, 6L, 7L, NA, 8L, 9L)), mf.agg = list(`(subject)` = c(4, 4, 5, 1, 2, 5, 4, 3, 2), `(fromstate)` = c(2, 1, 1, 1, 1, 1, 2, 1, 1), `(time)` = c(4.34080645274371, 0, 0, 0, 7.9621127679944, 0.724425864871591, 0.662206339277327, 0, 0), `(obstype)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1), `(obstrue)` = c(2, 1, 1, 1, 1, 1, 2, 1, 1), `(obs)` = c(11L, 9L, 13L, 2L, 5L, 14L, 10L, 7L, 4L), `(tostate)` = c(3, 2, 1, 3, 3, 3, 2, 3, 1), `(timelag)` = c(0.656686196569353, 0.662206339277327, 0.724425864871591, 0.813481943681836, 3.34625857770443, 3.56484543569386, 3.67860011346638, 4.29615335352719, 7.9621127679944), `(nocc)` = c(1, 1, 1, 1, 1, 1, 1, 1, 1), `(whicha)` = 1:9, `(noccsum)` = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_)), mm.cov = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), mm.cov.agg = c(1, 1, 1, 1, 1, 1, 1, 1, 1), mm.mcov = NULL,     mm.hcov = NULL, mm.icov = NULL, subject.weights = NULL),     qmodel = list(nstates = 3L, iso = 4, perm = c(1, 2, 3), qperm = 1:3,         npars = 3, imatrix = c(0, 0, 0, 1, 0, 0, 1, 1, 0), qmatrix = c(-0.233978505697303,         0, 0, 0.0467957011394606, -0.230665272945204, 0, 0.187182804557843,         0.230665272945204, 0), inits = c(0.0467957011394606,         0.187182804557843, 0.230665272945204), constr = 1:3,         ndpars = 3L, expm = 1), qcmodel = list(npars = 0, ncovs = 0,         ndpars = 0), cmodel = list(ncens = 0, censor = NULL,         states = NULL, states_list = NULL, index = NULL), hmodel = list(        hidden = FALSE, models = c(0, 0, 0), nipars = 0, nicoveffs = 0,         totpars = 0, ncoveffs = 0, ematrix = FALSE))
   7: do.call(optfn, args)
   8: msm.optim(opt.method, p, hessian, use.deriv, msmdata, qmodel,     qcmodel, cmodel, hmodel, ...)
   9: msm::msm(state ~ time, subject = id, data = sim_dat, qmatrix = qmat_from_tmat(tmat),     gen.inits = TRUE)
  10: eval(code, test_env)
  11: eval(code, test_env)
  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)
  13: doTryCatch(return(expr), name, parentenv, handler)
  14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  16: doTryCatch(return(expr), name, parentenv, handler)
  17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  18: tryCatchList(expr, classes, parentenv, handlers)
  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) {    })
  20: test_code(desc, code, env = parent.frame(), default_reporter = local_interactive_reporter())
  21: test_that("tmat_from_msm", {    eval_times <- function(n_obs, stop_time) {        cumsum(c(0, runif(n_obs - 1, 0, 2 * (stop_time - 4)/(n_obs -             1))))    }    set.seed(2)    sim_dat <- sim_id_weib(n = 5, n_obs = 6, stop_time = 15,         eval_times = eval_times, start_state = "stable", shape = c(1,             1, 1), scale = c(5, 10, 1))    tmat <- mstate::trans.illdeath()    sim_dat <- remove_redundant_observations(sim_dat, tmat)    msm_mod <- msm::msm(state ~ time, subject = id, data = sim_dat,         qmatrix = qmat_from_tmat(tmat), gen.inits = TRUE)    tmat_msm <- tmat_from_msm(msm_mod)    expect_true(all(tmat_msm == tmat, na.rm = TRUE))})
  22: eval(code, test_env)
  23: eval(code, test_env)
  24: 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)
  25: doTryCatch(return(expr), name, parentenv, handler)
  26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  27: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  28: doTryCatch(return(expr), name, parentenv, handler)
  29: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  30: tryCatchList(expr, classes, parentenv, handlers)
  31: 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) {    })
  32: test_code(test = NULL, code = exprs, env = env, default_reporter = StopReporter$new())
  33: source_file(path, env = env(env), desc = desc, error_call = error_call)
  34: FUN(X[[i]], ...)
  35: lapply(test_paths, test_one_file, env = env, desc = desc, error_call = error_call)
  36: doTryCatch(return(expr), name, parentenv, handler)
  37: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  38: tryCatchList(expr, classes, parentenv, handlers)
  39: tryCatch(code, testthat_abort_reporter = function(cnd) {    cat(conditionMessage(cnd), "\n")    NULL})
  40: with_reporter(reporters$multi, lapply(test_paths, test_one_file,     env = env, desc = desc, error_call = error_call))
  41: test_files_serial(test_dir = test_dir, test_package = test_package,     test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,     env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     desc = desc, load_package = load_package, error_call = error_call)
  42: test_files(test_dir = path, test_paths = test_paths, test_package = package,     reporter = reporter, load_helpers = load_helpers, env = env,     stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     load_package = load_package, parallel = parallel)
  43: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  44: test_check("icmstate")
  An irrecoverable exception occurred. R is aborting now ...