Skip to content

clustra

Clustering Longitudinal Trajectories

v0.2.1 · Jan 10, 2024 · BSD 2-clause License + file LICENSE

Description

Clusters longitudinal trajectories over time (can be unequally spaced, unequal length time series and/or partially overlapping series) on a common time axis. Performs k-means clustering on a single continuous variable measured over time, where each mean is defined by a thin plate spline fit to all points in a cluster. Distance is MSE across trajectory points to cluster spline. Provides graphs of derived cluster splines, silhouette plots, and Adjusted Rand Index evaluations of the number of clusters. Scales well to large data with multicore parallelism available to speed computation.

Downloads

293

Last 30 days

10725th

608

Last 90 days

608

Last year

Trend: -7% (30d vs prior 30d)

CRAN Check Status

1 ERROR
13 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (14 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
ERROR r-devel-macos-arm64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘clustra_bp_vignette.Rmd’ using rmarkdown

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

Traceback:
 1: Predict.matrix.tprs.smooth(object, dk$data)

Traceback:
 1: Predict.matrix.tprs.smooth(object, dk$data)
 2:  2: Predict.matrix(object, dk$data)
 3: Predict.matrix3(object, data)
 4: PredictMat(object$smooth[[i]], dk$mf, n = dk$nr[termk])
 5: predict.bamd(object, newdata, type, se.fit, terms, exclude, block.size,     newdata.guaranteed, na.action, n.threads, gc.level = gc.level,     ...)
 6: Predict.matrix(object, dk$data)
 3: Predict.matrix3(object, data)mgcv::predict.bam(object = tps, newdata = newdata, type = "response",     newdata.guaranteed = TRUE)
 7: as.vector(mgcv::predict.bam(object = tps, newdata = newdata,     type = "response", newdata.guaranteed = TRUE))
 8: FUN(X[[i]], ...)
 9: 
 4: PredictMat(object$smooth[[i]], dk$mf, n = dk$nr[termk])
lapply(X = S, FUN = FUN, ...)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
 5: predict.bamd(object, newdata, type, se.fit, terms, exclude, block.size,     newdata.guaranteed, na.action, n.threads, gc.level = gc.level,     ...)13: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {
 6: mgcv::predict.bam(object = tps, newdata = newdata, type = "response",     newdata.guaranteed = TRUE)        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 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) 
 7: as.vector(mgcv::predict.bam(object = tps, newdata = newdata,     type = "response", newdata.guaranteed = TRUE))
 8: FUN(X[[i]], ...)
 9: lapply(X = S, FUN = FUN, ...)
            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))})
14: 10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
15: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
16: FUN(X[[i]], ...)
17: 13: tryCatch(expr, error = function(e) {lapply(seq_len(cores), inner.do)
    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 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], 18: parallel::mclapply(tps, pred_g, newdata = newdata, mc.cores = mccores)
19: trajectories(data, k, group, maxdf, conv, mccores, verbose = verbose,     ...)
20: clustra(data, k = 5, maxdf = 30, conv = c(20, 0.5), mccores = mc,     verbose = TRUE)
                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())    }21: eval(expr, envir)
22: eval(expr, envir)
23: withVisible(eval(expr, envir))
24: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) {    watcher$capture_plot_and_output()    if (on_message$capture) {        watcher$push(cnd)    }    if (on_message$silence) {        invokeRestart("muffleMessage")    }}, warning = function (cnd) {    if (getOption("warn") >= 2 || getOption("warn") < 0) {    invisible(structure(msg, class = "try-error", condition = e))})
14:         return()    }    watcher$capture_plot_and_output()    if (on_warning$capture) {        cnd <- sanitize_call(cnd)        watcher$push(cnd)    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    }}, error = function (cnd) {try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
15: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
16:     watcher$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)FUN(X[[i]], ...)
17:     switch(on_error, continue = invokeRestart("eval_continue"),         stop = invokeRestart("eval_stop"), error = NULL)})lapply(seq_len(cores), inner.do)
18: 
25: eval(call)parallel::mclapply(tps, pred_g, newdata = newdata, mc.cores = mccores)
19: 
26: eval(call)trajectories(data, k, group, maxdf, conv, mccores, verbose = verbose,     ...)
20: clustra(data, k = 5, maxdf = 30, conv = c(20, 0.5), mccores = mc,     verbose = TRUE)
27: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE
21: eval(expr, envir)}, handlers)
28: 
22: eval(expr, envir)doWithOneRestart(return(expr), restart)
29: 
23: withVisible(eval(expr, envir))withOneRestart(expr, restarts[[1L]])
30: 
24: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) {    watcher$capture_plot_and_output()withRestartList(expr, restarts[-nr])
31:     if (on_message$capture) {        watcher$push(cnd)    }doWithOneRestart(return(expr), restart)
32:     if (on_message$silence) {        invokeRestart("muffleMessage")    }withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
33: }, warning = function (cnd) {    if (getOption("warn") >= 2 || getOption("warn") < 0) {        return()    }    watcher$capture_plot_and_output()withRestartList(expr, restarts)
34:     if (on_warning$capture) {        cnd <- sanitize_call(cnd)        watcher$push(cnd)withRestarts(with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)
    }}, error = function (cnd) {    watcher$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)35: evaluate::evaluate(...)
36: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L    switch(on_error, continue = invokeRestart("eval_continue"),         stop = invokeRestart("eval_stop"), error = NULL)})        else 2L    }, output_handler = knit_handlers(options$render, options))

25: eval(call)37: in_dir(input_dir(), expr)

26: eval(call)38: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include) 
27: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE            0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
39: eng_r(options)
40: block_exec(params)
41: }, handlers)
28: doWithOneRestart(return(expr), restart)
29: call_block(x)
42: process_group(group)
43: withOneRestart(expr, restarts[[1L]])
30: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt)) withRestartList(expr, restarts[-nr])
31: doWithOneRestart(return(expr), restart)
32:             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    })
44: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
33: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt)) withRestartList(expr, restarts)
34:             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)withRestarts(with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    }), list(rlang_trace_top_env = knit_global()))
45:     TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)
xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt)) 35: evaluate::evaluate(...)
            pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)36: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L    }), list(rlang_trace_top_env = knit_global())), function(loc) {    setwd(wd)    write_utf8(res, output %n% stdout())        else 2L    }, output_handler = knit_handlers(options$render, options))
    paste0("\nQuitting from ", loc, if (!is.null(error))         paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)37: in_dir(input_dir(), expr)

46: process_file(text, output)38: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include) 
47: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)            0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
48: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), 
39: eng_r(options)    output_dir = getwd(), ...)
49: 
40: block_exec(params)vweave_rmarkdown(...)
50: 
41: call_block(x)
42: process_group(group)engine$weave(file, quiet = quiet, encoding = enc)
51: doTryCatch(return(expr), name, parentenv, handler)
52: 
43: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()tryCatchOne(expr, names, parentenv, handlers[[1L]])
53:         if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    })tryCatchList(expr, classes, parentenv, handlers)
54: 
44: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), 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)    error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        output <- find_vignette_product(name, by = "texi2pdf",             engine = engine)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)))})
        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global()))
45: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()55: tools:::.buildOneVignette("clustra_bp_vignette.Rmd", "/Volumes/Builds/packages/sonoma-arm64/results/4.6/clustra.Rcheck/vign_test/clustra",     TRUE, FALSE, "clustra_bp_vignette", "UTF-8", "/Volumes/Temp/tmp/RtmphL3YLn/file1a353971c7f0.rds")
An irrecoverable exception occurred. R is aborting now ...
        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global())), function(loc) {    setwd(wd)    write_utf8(res, output %n% stdout())    paste0("\nQuitting from ", loc, if (!is.null(error))         paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)
46: process_file(text, output)
47: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
48: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
49: vweave_rmarkdown(...)
50: engine$weave(file, quiet = quiet, encoding = enc)
51: doTryCatch(return(expr), name, parentenv, handler)
52: tryCatchOne(expr, names, parentenv, handlers[[1L]])
53: tryCatchList(expr, classes, parentenv, handlers)
54: 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)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)))})
55: tools:::.buildOneVignette("clustra_bp_vignette.Rmd", "/Volumes/Builds/packages/sonoma-arm64/results/4.6/clustra.Rcheck/vign_test/clustra",     TRUE, FALSE, "clustra_bp_vignette", "UTF-8", "/Volumes/Temp/tmp/RtmphL3YLn/file1a353971c7f0.rds")
An irrecoverable exception occurred. R is aborting now ...

Quitting from clustra_bp_vignette.Rmd:71-74 [run5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `apply()`:
! dim(X) must have a positive length
---
Backtrace:
    ▆
 1. └─clustra::clustra(...)
 2.   └─clustra::trajectories(...)
 3.     └─base::apply(loss, 1, which.min)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'clustra_bp_vignette.Rmd' failed with diagnostics:
dim(X) must have a positive length
--- failed re-building ‘clustra_bp_vignette.Rmd’

--- re-building ‘clustra_vignette.Rmd’ using rmarkdown

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

Traceback:
 1: predict.gam(object, newdata = newdata, type = type, se.fit = se.fit,     terms = terms, exclude = exclude, block.size = block.size,     newdata.guaranteed = newdata.guaranteed, na.action = na.action,     ...)
 2: mgcv::predict.bam(object = tps, newdata = newdata, type = "response",     newdata.guaranteed = TRUE)
 3: as.vector(mgcv::predict.bam(object = tps, newdata = newdata,     type = "response", newdata.guaranteed = TRUE))
 4: FUN(X[[i]], ...)
 5: lapply(X = S, FUN = FUN, ...)
 6: doTryCatch(return(expr), name, parentenv, handler)
 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 8: tryCatchList(expr, classes, parentenv, handlers)
 9: 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, nlines = 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))})
10: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
11: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
12: FUN(X[[i]], ...)
13: lapply(seq_len(cores), inner.do)
14: parallel::mclapply(sfit, pred_g, newdata = newdata, mc.cores = mccores)
15: start_groups(k, data, starts, maxdf, conv, mccores, verbose = verbose)
16: clustra(data, k = 40, starts = "distant", maxdf = 10, conv = c(10,     0), mccores = mc, verbose = TRUE)
17: eval(expr, envir)
18: eval(expr, envir)
19: withVisible(eval(expr, envir))
20: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) {    watcher$capture_plot_and_output()    if (on_message$capture) {        watcher$push(cnd)    }    if (on_message$silence) {        invokeRestart("muffleMessage")    }}, warning = function (cnd) {    if (getOption("warn") >= 2 || getOption("warn") < 0) {        return()    }    watcher$capture_plot_and_output()    if (on_warning$capture) {        cnd <- sanitize_call(cnd)        watcher$push(cnd)    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    }}, error = function (cnd) {    watcher$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)    switch(on_error, continue = invokeRestart("eval_continue"),         stop = invokeRestart("eval_stop"), error = NULL)})
21: eval(call)
22: eval(call)
23: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers)
24: doWithOneRestart(return(expr), restart)
25: withOneRestart(expr, restarts[[1L]])
26: withRestartList(expr, restarts[-nr])
27: doWithOneRestart(return(expr), restart)
28: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
29: withRestartList(expr, restarts)
30: withRestarts(with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)
31: evaluate::evaluate(...)
32: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options))
33: in_dir(input_dir(), expr)
34: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
35: eng_r(options)
36: block_exec(params)
37: call_block(x)
38: process_group(group)
39: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    })
40: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global()))
41: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global())), function(loc) {    setwd(wd)    write_utf8(res, output %n% stdout())    paste0("\nQuitting from ", loc, if (!is.null(error))         paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)
42: process_file(text, output)
43: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
44: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
45: vweave_rmarkdown(...)
46: engine$weave(file, quiet = quiet, encoding = enc)
47: doTryCatch(return(expr), name, parentenv, handler)
48: tryCatchOne(expr, names, parentenv, handlers[[1L]])
49: tryCatchList(expr, classes, parentenv, handlers)
50: 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)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)))})
51: tools:::.buildOneVignette("clustra_vignette.Rmd", "/Volumes/Builds/packages/sonoma-arm64/results/4.6/clustra.Rcheck/vign_test/clustra",     TRUE, FALSE, "clustra_vignette", "UTF-8", "/Volumes/Temp/tmp/RtmphL3YLn/file1a353bbf7ea2.rds")
An irrecoverable exception occurred. R is aborting now ...

Traceback:
 1: predict.gam(object, newdata = newdata, type = type, se.fit = se.fit,     terms = terms, exclude = exclude, block.size = block.size,     newdata.guaranteed = newdata.guaranteed, na.action = na.action,     ...)
 2: mgcv::predict.bam(object = tps, newdata = newdata, type = "response",     newdata.guaranteed = TRUE)
 3: as.vector(mgcv::predict.bam(object = tps, newdata = newdata,     type = "response", newdata.guaranteed = TRUE))
 4: FUN(X[[i]], ...)
 5: lapply(X = S, FUN = FUN, ...)
 6: doTryCatch(return(expr), name, parentenv, handler)
 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 8: tryCatchList(expr, classes, parentenv, handlers)
 9: 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, nlines = 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))})
10: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
11: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
12: FUN(X[[i]], ...)
13: lapply(seq_len(cores), inner.do)
14: parallel::mclapply(sfit, pred_g, newdata = newdata, mc.cores = mccores)
15: start_groups(k, data, starts, maxdf, conv, mccores, verbose = verbose)
16: clustra(data, k = 40, starts = "distant", maxdf = 10, conv = c(10,     0), mccores = mc, verbose = TRUE)
17: eval(expr, envir)
18: eval(expr, envir)
19: withVisible(eval(expr, envir))
20: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) {    watcher$capture_plot_and_output()    if (on_message$capture) {        watcher$push(cnd)    }    if (on_message$silence) {        invokeRestart("muffleMessage")    }}, warning = function (cnd) {    if (getOption("warn") >= 2 || getOption("warn") < 0) {        return()    }    watcher$capture_plot_and_output()    if (on_warning$capture) {        cnd <- sanitize_call(cnd)        watcher$push(cnd)    }    if (on_warning$silence) {        invokeRestart("muffleWarning")    }}, error = function (cnd) {    watcher$capture_plot_and_output()    cnd <- sanitize_call(cnd)    watcher$push(cnd)    switch(on_error, continue = invokeRestart("eval_continue"),         stop = invokeRestart("eval_stop"), error = NULL)})
21: eval(call)
22: eval(call)
23: with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers)
24: doWithOneRestart(return(expr), restart)
25: withOneRestart(expr, restarts[[1L]])
26: withRestartList(expr, restarts[-nr])
27: doWithOneRestart(return(expr), restart)
28: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
29: withRestartList(expr, restarts)
30: withRestarts(with_handlers({    for (expr in tle$exprs) {        ev <- withVisible(eval(expr, envir))        watcher$capture_plot_and_output()        watcher$print_value(ev$value, ev$visible, envir)    }    TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)
31: evaluate::evaluate(...)
32: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options))
33: in_dir(input_dir(), expr)
34: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = if (is.numeric(options$warning)) TRUE else options$warning,     keep_message = if (is.numeric(options$message)) TRUE else options$message,     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
35: eng_r(options)
36: block_exec(params)
37: call_block(x)
38: process_group(group)
39: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    })
40: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global()))
41: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        if (progress && is.function(pb$interrupt))             pb$interrupt()        if (is_R_CMD_build() || is_R_CMD_check())             error <<- format(e)    }), list(rlang_trace_top_env = knit_global())), function(loc) {    setwd(wd)    write_utf8(res, output %n% stdout())    paste0("\nQuitting from ", loc, if (!is.null(error))         paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)
42: process_file(text, output)
43: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
44: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
45: vweave_rmarkdown(...)
46: engine$weave(file, quiet = quiet, encoding = enc)
47: doTryCatch(return(expr), name, parentenv, handler)
48: tryCatchOne(expr, names, parentenv, handlers[[1L]])
49: tryCatchList(expr, classes, parentenv, handlers)
50: 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)    }}, error = function(e) {    OK <<- FALSE    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, conditionMessage(e)))})
51: tools:::.buildOneVignette("clustra_vignette.Rmd", "/Volumes/Builds/packages/sonoma-arm64/results/4.6/clustra.Rcheck/vign_test/clustra",     TRUE, FALSE, "clustra_vignette", "UTF-8", "/Volumes/Temp/tmp/RtmphL3YLn/file1a353bbf7ea2.rds")
An irrecoverable exception occurred. R is aborting now ...

Quitting from clustra_vignette.Rmd:129-139 [hclust_d]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `apply()`:
! dim(X) must have a positive length
---
Backtrace:
    ▆
 1. └─clustra::clustra(...)
 2.   └─clustra:::start_groups(...)
 3.     └─base::apply(loss, 1, which.min)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'clustra_vignette.Rmd' failed with diagnostics:
dim(X) must have a positive length
--- failed re-building ‘clustra_vignette.Rmd’

SUMMARY: processing the following files failed:
  ‘clustra_bp_vignette.Rmd’ ‘clustra_vignette.Rmd’

Error: Vignette re-building failed.
Execution halted
OK r-devel-windows-x86_64

*


            
OK r-oldrel-macos-arm64

*


            
OK r-oldrel-macos-x86_64

*


            
OK r-oldrel-windows-x86_64

*


            
OK r-patched-linux-x86_64

*


            
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
OK r-release-windows-x86_64

*


            

Check History

ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 9, 2026
ERROR r-devel-macos-arm64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘clustra_bp_vignette.Rmd’ using rmarkdown

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

Traceback:
 1: Predict.matrix.tprs.smooth(object, dk$data)

Traceback:
 1: Predict.matrix.tprs.smooth(object, dk$data)
 2:  2: Predict.matrix(object, dk$data)
 3: Predict.matrix3(object, data)
 4: PredictMat(object$smooth[[i]], dk$mf, n = dk$nr[termk])
 5: predict.bam

Dependency Network

Dependencies Reverse dependencies data.table mgcv MixSim clustra

Version History

new 0.2.1 Mar 9, 2026