Running ‘testthat.R’ [91s/98s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(drtmle)
  drtmle: TMLE with doubly robust inference
  Version: 1.0.4
  > 
  > test_check("drtmle")
  ── 1. Error: adaptive_iptw works as expected with missing data (@test-adaptive_i
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: adaptive_iptw(W = W, A = A, Y = Y, a_0 = c(0, 1), glm_g = "W1 + W2", glm_Qr = "gn") at testthat/test-adaptive_iptw-missingAY.R:19
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0, stratify = stratify)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ── 2. Error: drtmle executes as expected with stratify = TRUE (@test-drtmle-miss
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: drtmle(W = W, A = A, Y = Y, DeltaY = DeltaY, DeltaA = DeltaA, family = gaussian(), 
         stratify = FALSE, glm_Q = "W1 + W2", glm_g = list(DeltaA = "W1 + W2", DeltaY = "W1 + W2", 
             A = "W1 + W2"), glm_Qr = "gn", glm_gr = "Qn", guard = c("Q", "g"), reduction = "univariate") at testthat/test-drtmle-missingAY.R:23
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, stratify = stratify, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ── 3. Error: drtmle executes as expected with stratify = FALSE (@test-drtmle-mis
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: drtmle(W = W, A = A, Y = Y, family = gaussian(), stratify = FALSE, glm_Q = "W1 + W2", 
         glm_g = "W1 + W2", glm_Qr = "gn", glm_gr = "Qn", guard = c("Q", "g"), reduction = "univariate") at testthat/test-drtmle-missingAY.R:188
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, stratify = stratify, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ── 4. Error: GitHub error #16 resolves (@test-drtmle.R#503)  ───────────────────
  <text>:1:5: unexpected symbol
  1: A~X A
          ^
  1: drtmle(W = X, A = A, Y = Y, a_0 = 1, glm_Q = "X", glm_g = "X", SL_Qr = "SL.npreg", 
         guard = "Q", returnModel = TRUE) at testthat/test-drtmle.R:503
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, stratify = stratify, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ── 5. Error: Fail safe kicks in (@test-fluctuate.R#36)  ────────────────────────
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, DeltaY = DeltaY, 
         tolg = tolg, verbose = verbose, stratify = stratify, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0) at testthat/test-fluctuate.R:36
  2: FUN(X[[i]], ...)
  3: stats::glm(stats::as.formula(paste0("A~", glm_g)), data = thisDat, family = stats::binomial())
  4: eval(mf, parent.frame())
  5: eval(mf, parent.frame())
  6: stats::model.frame(formula = stats::as.formula(paste0("A~", glm_g)), data = thisDat, 
         drop.unused.levels = TRUE)
  7: stats::as.formula(paste0("A~", glm_g))
  8: formula(object, env = baseenv())
  9: formula.character(object, env = baseenv())
  10: str2lang(x)
  
  ── 6. Error: drtmle executes as expected with multiple treatment levels (@test-m
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: drtmle(W = W, A = A, Y = Y, a_0 = c(0, 1, 2), family = gaussian(), stratify = TRUE, 
         glm_Q = "W1 + W2", glm_g = "W1 + W2", glm_Qr = "gn", glm_gr = "Qn", guard = c("Q", 
             "g"), reduction = "univariate", returnModels = TRUE) at testthat/test-multileveltrt.R:16
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, stratify = stratify, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ── 7. Error: adaptive_iptw executes as expected with multiple treatment levels (
  <text>:1:11: unexpected symbol
  1: A~W1 + W2 A
                ^
  1: adaptive_iptw(W = W, A = A, Y = Y, a_0 = c(0, 1, 2), glm_g = "W1 + W2", returnModels = TRUE, 
         glm_Qr = "gn") at testthat/test-multileveltrt.R:95
  2: future.apply::future_lapply(X = validRows, FUN = estimateG, A = A, W = W, DeltaA = DeltaA, 
         DeltaY = DeltaY, tolg = tolg, verbose = verbose, returnModels = returnModels, 
         SL_g = SL_g, glm_g = glm_g, a_0 = a_0, stratify = stratify)
  3: future({
         ...future.globals.maxSize.org <- getOption("future.globals.maxSize")
         if (!identical(...future.globals.maxSize.org, ...future.globals.maxSize)) {
             oopts <- options(future.globals.maxSize = ...future.globals.maxSize)
             on.exit(options(oopts), add = TRUE)
         }
         lapply(seq_along(...future.elements_ii), FUN = function(jj) {
             ...future.X_jj <- ...future.elements_ii[[jj]]
             ...future.FUN(...future.X_jj, ...)
         })
     }, envir = envir, stdout = future.stdout, conditions = future.conditions, globals = globals_ii, 
         packages = packages_ii, lazy = future.lazy)
  4: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         packages = packages, ...)
  5: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy, seed = seed, globals = globals, 
         local = local, earlySignal = earlySignal, label = label, ...)
  6: run(future)
  7: run.UniprocessFuture(future)
  8: signalEarly(future, collect = FALSE)
  9: resolved(future)
  10: resolved.UniprocessFuture(future)
  11: NextMethod()
  12: resolved.Future(future)
  13: signalEarly(x, ...)
  14: resignalConditions(future)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 451 SKIPPED: 0 WARNINGS: 31 FAILED: 7
  1. Error: adaptive_iptw works as expected with missing data (@test-adaptive_iptw-missingAY.R#19) 
  2. Error: drtmle executes as expected with stratify = TRUE (@test-drtmle-missingAY.R#23) 
  3. Error: drtmle executes as expected with stratify = FALSE (@test-drtmle-missingAY.R#188) 
  4. Error: GitHub error #16 resolves (@test-drtmle.R#503) 
  5. Error: Fail safe kicks in (@test-fluctuate.R#36) 
  6. Error: drtmle executes as expected with multiple treatment levels (@test-multileveltrt.R#16) 
  7. Error: adaptive_iptw executes as expected with multiple treatment levels (@test-multileveltrt.R#95) 
  
  Error: testthat unit tests failed
  Execution halted