inst/testme/test-futurize-pvclust.R

#' @tags pkg-pvclust
if (requireNamespace("pvclust") && getRversion() >= "4.4.0") {
library(futurize)
library(pvclust)
fcns <- tryCatch({
  futurize::futurize_supported_functions("pvclust")
}, error = identity)
print(fcns)
stopifnot(is.character(fcns), length(fcns) > 0L)
options(future.rng.onMisuse = "error")

all_equal <- function(a, b, ...) {
  a$call <- b$call <- NULL
  all.equal(a, b, ...)
}

plan(multisession)

#------------------------------------------------------------------
# pvclust()
#------------------------------------------------------------------
message("pvclust() ...")
data(mtcars, package = "datasets")

set.seed(42)
fit_truth <- pvclust(mtcars, nboot = 10L, parallel = FALSE)
print(fit_truth)

set.seed(42)
fit <- pvclust(mtcars, nboot = 10L, parallel = FALSE) |> futurize_and_verify()
print(fit)

stopifnot(inherits(fit, "pvclust"))
stopifnot(length(fit$edges) == length(fit_truth$edges))

message("pvclust() ... done")

plan(sequential)
}

Try the futurize package in your browser

Any scripts or data that you put into this service are public.

futurize documentation built on Oct. 20, 2026, 1:06 a.m.