Nothing
# tests/testthat/helper-tablearn.R
# Shared deterministic fixtures for tablearn() tests.
#
# Keep test data behind a function rather than a top-level object. testthat
# sources helper*.R files for test_check(), and each test obtains a fresh copy
# so tests remain independent and reproducible.
.tablearn_test_data <- function(n = 120L, seed = 20260814L) {
n <- as.integer(n)
seed <- as.integer(seed)
if (length(n) != 1L || is.na(n) || n < 40L) {
stop("`n` must be one integer >= 40 for tablearn tests.", call. = FALSE)
}
# Current operator tests expect two equally sized operator series.
if (n %% 2L != 0L) n <- n + 1L
set.seed(seed)
d <- data.frame(
case = seq_len(n),
surgeon = rep(c("A", "B"), each = n / 2L),
complexity = stats::rbinom(n, 1, 0.35),
stringsAsFactors = FALSE
)
d$time <- 105 - 42 * (1 - exp(-d$case / 28)) +
7 * d$complexity + stats::rnorm(n, 0, 8)
d$risk <- stats::plogis(
-2.0 + 0.8 * d$complexity - 0.018 * d$case
)
d$complication <- stats::rbinom(n, 1, d$risk)
d
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.