Error: 'make_folds' is not an exported object from 'namespace:origami'

context("Fidelity of estimates with censoring")
A <- c("A1", "A2")
L <- list(c("L1"), c("L2"))
C <- c("C1", "C2")
truth <- 0.8
sub <- sw(lmtp_sub(sim_cens, A, "Y", time_vary = L, cens = C, k = 0, shift = NULL, folds = 1))
ipw <- sw(lmtp_ipw(sim_cens, A, "Y", time_vary = L, cens = C, k = 0, shift = NULL, folds = 1))
tmle <- sw(lmtp_tmle(sim_cens, A, "Y", time_vary = L, cens = C, k = 0, shift = NULL, folds = 1))
sdr <- sw(lmtp_sdr(sim_cens, A, "Y", time_vary = L, cens = C, k = 0, shift = NULL, folds = 1))
# tests
test_that("estimator fidelity with censoring", {
expect_equal(truth, sub$theta, tolerance = 0.15)
expect_equal(truth, ipw$theta, tolerance = 0.15)
expect_equal(truth, tmle$theta, tolerance = 0.15)
expect_equal(truth, sdr$theta, tolerance = 0.15)
})

lmtp_sub(list(), A, "tmp_lmtp_stack_indicator", time_vary = L, cens = cens),
"Assertion on 'data' failed: Must be of type 'data.frame', not 'list'."
lmtp_sub(sim_cens, A, "Y", time_vary = L, cens = cens),
"Assertion on 'data' failed: Must be a 'data.frame', not a 'data.table'."
test_that("No uncensored missing data", {
"Assertion on 'data' failed: Missing data found in treatment and/or covariate nodes for uncensored observations."
lmtp_sub(sim_cens, A, "tmp_lmtp_stack_indicator", time_vary = L, cens = cens),
"Assertion on 'data' failed: 'lmtp_id', 'tmp_lmtp_stack_indicator', and 'tmp_lmtp_scaled_outcome' are reserved variable names."
lmtp_sub(sim_cens, A, "Y", time_vary = L, cens = cens, folds = 0),
"Assertion on 'folds' failed: Element 1 is not >= 1."
"Assertion on 'c(unlist(trt), outcome, baseline, unlist(time_vary), cens, id)' failed: Must be a subset of {'L1','A1','C1','L2','A2','C2','Y'}, but has additional elements {'A'}.",
"Assertion on 'time_vary' failed: Must be of type 'list' (or 'NULL'), not 'character'.",
"Assertion on 'cens' failed: Must have length 1, but has length 2."
test_that("No outcome variation changes learners", {
x <- check_variation(rep(0.5, 10), "SL.glm")
test_that("Only 0 and 1 in 'outcome' when binary or surival", {
sim_cens$Y <- sample(c(3, 4), nrow(sim_cens), replace = TRUE)
"Assertion on 'data' failed: Only 0 and 1 allowed in outcome variables if 'outcome_type' set to binomial or survival."
test_that("Issues with 'outcome_type' being or not being survival", {
lmtp_sub(sim_cens, A, "Y", time_vary = L, cens = cens, outcome_type = "survival"),
"Assertion on 'outcome' failed: Must have length >= 2, but has length 1."
lmtp_ipw(sim_point_surv, A, Y, W, cens = cens, shift = static_binary_on),
"Assertion on 'outcome' failed: Must have length 1, but has length 6."
test_that("Issues with 'shift' function and providing 'shifted' data", {
shifted <- shift_data(sim_cens, A, cens, function(data, trt) data[[trt]] + 0.5)
lmtp_tmle(sim_cens, A, "Y", time_vary = L, cens = cens, shift = function(data, trt, extra) data[[trt]] + 0.5),
"Assertion on 'shift' failed: Must have exactly 2 formal arguments, but has 3."
lmtp_tmle(sim_cens, A, "Y", time_vary = L, cens = cens, shifted = shifted),
"Assertion on 'shifted' failed: The only columns that can be different between `data` and `shifted` are those indicated in `trt` and `cens`."
shifted <- shift_data(sim_cens, A, NULL, function(data, trt) data[[trt]] + 0.5)
"Assertion on 'shifted' failed: Censoring variables should be 1 in 'shifted'."
fit <- lmtp_sub(sim_cens, A, "Y", time_vary = L, cens = cens, folds = 1)
"Assertion on 'fits' failed: Contrasts not implemented for substitution/IPW estimators."
fit <- lmtp_sdr(sim_cens, A, "Y", time_vary = L, cens = cens, folds = 1, mtp = TRUE)
"Assertion on 'ref' failed: Must either be a single numeric value or another lmtp object."
lmtp_contrast(fit, "Not lmtp object", ref = 0.1),
"Assertion on 'fits' failed: Objects must be of type 'lmtp'."
fit <- lmtp_sdr(sim_cens, A, "Y", time_vary = L, cens = cens, folds = 1, outcome_type = "continuous", mtp = TRUE)
lmtp_contrast(fit, ref = 0.1, type = "rr"),
"Assertion on 'type' failed: 'rr' specified but one or more outcome types are not 'binomial' or 'survival'."