Running ‘testthat.R’ [159s/171s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(TrialEmulation)
  > 
  > data.table::setDTthreads(2)
  > test_check("TrialEmulation")
  Saving _problems/test-data_extension-89.R
  Saving _problems/test-data_extension-136.R
  Saving _problems/test-data_extension-189.R
  Saving _problems/test-data_manipulation-3.R
  Saving _problems/test-data_manipulation-25.R
  Saving _problems/test-data_manipulation-52.R
  Saving _problems/test-data_manipulation-69.R
  Starting data manipulation
  Saving _problems/test-data_preparation-13.R
  Saving _problems/test-data_preparation-94.R
  Starting data manipulation
  Saving _problems/test-data_preparation-121.R
  Starting data manipulation
  Saving _problems/test-data_preparation-144.R
  Saving _problems/test-data_preparation-170.R
  Saving _problems/test-generics-24.R
  Saving _problems/test-generics-64.R
  Saving _problems/test-generics-94.R
  Saving _problems/test-modelling-404.R
  Saving _problems/test-modelling-464.R
  Saving _problems/test-predict-21.R
  Saving _problems/test-predict-156.R
  Saving _problems/test-sampling-83.R
  Saving _problems/test-sampling-100.R
  Saving _problems/test-sampling-119.R
  Saving _problems/test-sampling-238.R
  Saving _problems/test-te_datastore-5.R
  Saving _problems/test-te_datastore_csv-73.R
  Saving _problems/test-te_datastore_csv-179.R
  Saving _problems/test-te_datastore_duckdb-22.R
  Saving _problems/test-te_datastore_duckdb-63.R
  Saving _problems/test-te_datastore_duckdb-147.R
  Saving _problems/test-te_weights-16.R
  Saving _problems/test-te_weights-52.R
  Saving _problems/test-te_weights-85.R
  Saving _problems/test-trial_sequence-55.R
  Saving _problems/test-trial_sequence-70.R
  Saving _problems/test-trial_sequence-85.R
  Saving _problems/test-trial_sequence-101.R
  Saving _problems/test-trial_sequence-164.R
  Saving _problems/test-trial_sequence-191.R
  Saving _problems/test-trial_sequence-210.R
  Saving _problems/test-trial_sequence-224.R
  Saving _problems/test-trial_sequence-243.R
  Saving _problems/test-trial_sequence-264.R
  Saving _problems/test-trial_sequence-280.R
  Saving _problems/test-trial_sequence-325.R
  Saving _problems/test-trial_sequence-380.R
  Saving _problems/test-trial_sequence-399.R
  Saving _problems/test-trial_sequence-414.R
  Saving _problems/test-trial_sequence-429.R
  Saving _problems/test-trial_sequence-451.R
  Saving _problems/test-trial_sequence-457.R
  Saving _problems/test-trial_sequence-468.R
  Saving _problems/test-trial_sequence-507.R
  Saving _problems/test-trial_sequence-538.R
  Saving _problems/test-trial_sequence-580.R
  [ FAIL 55 | WARN 4 | SKIP 22 | PASS 181 ]
  
  ══ Skipped tests (22) ══════════════════════════════════════════════════════════
  • On CRAN (22): 'test-data_utils.R:1:1', 'test-data_utils.R:100:1',
    'test-data_utils.R:115:1', 'test-modelling.R:99:3', 'test-modelling.R:154:3',
    'test-modelling.R:175:3', 'test-modelling.R:205:3', 'test-modelling.R:229:3',
    'test-modelling.R:266:3', 'test-modelling.R:290:3', 'test-modelling.R:314:3',
    'test-modelling.R:357:3', 'test-predict.R:34:1', 'test-predict.R:86:1',
    'test-sampling.R:1:1', 'test-sampling.R:11:1', 'test-sampling.R:18:1',
    'test-sampling.R:40:1', 'test-sampling.R:180:3',
    'test-trial_sequence.R:40:1', 'test-trial_sequence.R:44:1',
    'test-trial_sequence.R:48:1'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-data_extension.R:78:3'): expand works as expected ──────────────
  Error in ``[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation:::expand(...) at test-data_extension.R:78:3
   2.   ├─temp_data[, `:=`(wtprod, 1), by = id]
   3.   └─data.table:::`[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)
  ── Error ('test-data_extension.R:124:3'): data extensions works as expected with first and last periods ──
  Error in ``[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation:::data_extension(...) at test-data_extension.R:124:3
   2.   └─TrialEmulation:::expand(...)
   3.     ├─temp_data[, `:=`(wtprod, 1), by = id]
   4.     └─data.table:::`[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)
  ── Error ('test-data_extension.R:176:3'): data extensions works as expected with separate_files=TRUE ──
  Error in ``[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation:::data_extension(...) at test-data_extension.R:176:3
   2.   └─TrialEmulation:::expand(...)
   3.     ├─temp_data[, `:=`(wtprod, 1), by = id]
   4.     └─data.table:::`[.data.table`(temp_data, , `:=`(wtprod, 1), by = id)
  ── Error ('test-data_manipulation.R:3:3'): data_manipulation works as expected with no censoring ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation:::data_manipulation(object, use_censor = FALSE) at test-data_manipulation.R:3:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test-data_manipulation.R:25:3'): data_manipulation works as expected with censoring ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation:::data_manipulation(object, use_censor = TRUE) at test-data_manipulation.R:25:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test-data_manipulation.R:49:3'): data_manipulation works as expected with observations before eligibilitiy ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_warning(...) at test-data_manipulation.R:49:3
   2. │ └─testthat:::expect_condition_matching_(...)
   3. │   └─testthat:::quasi_capture(...)
   4. │     ├─testthat (local) .capture(...)
   5. │     │ └─base::withCallingHandlers(...)
   6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   7. └─TrialEmulation:::data_manipulation(object, use_censor = TRUE)
   8.   ├─...[]
   9.   └─data.table:::`[.data.table`(...)
  ── Error ('test-data_manipulation.R:66:3'): data_manipulation works as expected with observations after outcome ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_warning(...) at test-data_manipulation.R:66:3
   2. │ └─testthat:::expect_condition_matching_(...)
   3. │   └─testthat:::quasi_capture(...)
   4. │     ├─testthat (local) .capture(...)
   5. │     │ └─base::withCallingHandlers(...)
   6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   7. └─TrialEmulation:::data_manipulation(object, use_censor = TRUE)
   8.   ├─...[]
   9.   └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:4:3'): data_preparation works as expected ───
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-data_preparation.R:4:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:26:3'): data_preparation can be quiet ───────
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_silent(...) at test-data_preparation.R:26:3
    2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
    3. │   ├─testthat (local) .capture(...)
    4. │   │ ├─withr::with_output_sink(...)
    5. │   │ │ └─base::force(code)
    6. │   │ ├─base::withCallingHandlers(...)
    7. │   │ └─base::withVisible(code)
    8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    9. └─TrialEmulation::data_preparation(...)
   10.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   11.     ├─...[]
   12.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:83:3'): data_preparation has correct values for 'treatment' ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-data_preparation.R:83:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:111:3'): data_preparation works with PP estimand type ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-data_preparation.R:111:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:133:3'): data_preparation works with As-Treated estimand type ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-data_preparation.R:133:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_preparation.R:156:3'): data_preparation works with ITT and censor weights ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-data_preparation.R:156:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-generics.R:5:3'): summary for data_preparation separate=TRUE ───
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-generics.R:5:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-generics.R:45:3'): summary for data_preparation separate=FALSE ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-generics.R:45:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-generics.R:75:3'): summary for initiators ──────────────────────
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_warning(...) at test-generics.R:75:3
    2. │ └─testthat:::expect_condition_matching_(...)
    3. │   └─testthat:::quasi_capture(...)
    4. │     ├─testthat (local) .capture(...)
    5. │     │ └─base::withCallingHandlers(...)
    6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    7. └─TrialEmulation::initiators(...)
    8.   └─TrialEmulation::data_preparation(...)
    9.     └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   10.       ├─...[]
   11.       └─data.table:::`[.data.table`(...)
  ── Error ('test-modelling.R:383:3'): fit_msm works ─────────────────────────────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-modelling.R:383:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-modelling.R:443:3'): fit_msm works with weight functions ───────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-modelling.R:443:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-predict.R:7:3'): predict.TE_msm works as expected ──────────────
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::initiators(...) at test-predict.R:7:3
   2.   └─TrialEmulation::data_preparation(...)
   3.     └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   4.       ├─...[]
   5.       └─data.table:::`[.data.table`(...)
  ── Error ('test-predict.R:146:3'): predict.TE_msm gives the same results as new predict ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'fit_msm': error in evaluating the argument 'object' in selecting a method for function 'load_expanded_data': error in evaluating the argument 'object' in selecting a method for function 'expand_trials': error in evaluating the argument 'object' in selecting a method for function 'set_expansion_options': error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::fit_msm(...) at test-predict.R:146:3
    2. ├─TrialEmulation::load_expanded_data(...)
    3. ├─TrialEmulation::expand_trials(...)
    4. ├─TrialEmulation::set_expansion_options(...)
    5. ├─TrialEmulation::set_outcome_model(...)
    6. ├─TrialEmulation::set_data(trial_sequence("ITT"), trial_ex)
    7. ├─TrialEmulation::set_data(trial_sequence("ITT"), trial_ex)
    8. │ └─TrialEmulation (local) .local(object, data, ...)
    9. │   ├─methods::callNextMethod(...)
   10. │   │ └─base::eval(call, callEnv)
   11. │   │   └─base::eval(call, callEnv)
   12. │   └─TrialEmulation (local) .nextMethod(...)
   13. │     └─TrialEmulation (local) .local(object, data, ...)
   14. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   15. │         ├─...[]
   16. │         └─data.table:::`[.data.table`(...)
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. ├─base::.handleSimpleError(...)
   20. │ └─base (local) h(simpleError(msg, call))
   21. ├─base::.handleSimpleError(...)
   22. │ └─base (local) h(simpleError(msg, call))
   23. ├─base::.handleSimpleError(...)
   24. │ └─base (local) h(simpleError(msg, call))
   25. └─base::.handleSimpleError(...)
   26.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-sampling.R:74:3'): case_control_sampling_trials works with separate_files = TRUE ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-sampling.R:74:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sampling.R:92:3'): case_control_sampling_trials works with separate_files = FALSE ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-sampling.R:92:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sampling.R:110:3'): case_control_sampling_trials works with separate_files = TRUE is reproducible ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 8/8 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─TrialEmulation::data_preparation(...) at test-sampling.R:110:3
   2.   └─TrialEmulation:::data_manipulation(data, use_censor = args$censor_at_switch)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sampling.R:221:3'): sample_controls works with trial_sequence objects containing te_datastore_datatable objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-sampling.R:221:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore.R:2:3'): read_expanded_data can read te_datastore_datatable data ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_expansion_options': error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_expansion_options(...) at test-te_datastore.R:2:3
    2. ├─TrialEmulation::set_outcome_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("ITT"), data = data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("ITT"), data = data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore_csv.R:56:3'): sample_controls works with trial_sequence objects containing te_datastore_csv objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-te_datastore_csv.R:56:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore_csv.R:162:3'): load_expanded_data works with trial_sequence objects containing te_datastore_csv objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-te_datastore_csv.R:162:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore_duckdb.R:19:3'): read_expanded_data can read te_datastore_duckdb data ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_expansion_options': error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_expansion_options(...) at test-te_datastore_duckdb.R:19:3
    2. ├─TrialEmulation::set_outcome_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("ITT"), data = data)
    4. ├─TrialEmulation::set_data(trial_sequence("ITT"), data = data)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore_duckdb.R:61:3'): sample_controls works with trial_sequence objects containing te_datastore_duckdb objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-te_datastore_duckdb.R:61:3
    2. ├─TrialEmulation::set_data(trial_sequence(estimand = "ITT"), data = data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence(estimand = "ITT"), data = data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_datastore_duckdb.R:145:3'): load_expanded_data works with trial_sequence objects containing te_datastore_duckdb objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-te_datastore_duckdb.R:145:3
    2. ├─TrialEmulation::set_data(trial_sequence(estimand = "ITT"), data = data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence(estimand = "ITT"), data = data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_weights.R:3:3'): show works for te_weights_spec objects ─────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_switch_weight_model(...) at test-te_weights.R:3:3
    2. ├─TrialEmulation::set_censor_weight_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_weights.R:45:3'): weight_model_data_indices works ───────────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::calculate_weights(...) at test-te_weights.R:45:3
    2. ├─TrialEmulation::set_switch_weight_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-te_weights.R:78:3'): weight_model_data_indices catches bad input ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::calculate_weights(...) at test-te_weights.R:78:3
    2. ├─TrialEmulation::set_switch_weight_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:53:3'): show works for trial_sequence_PP with data and outcome_model set ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:53:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:63:3'): set_data works for trial_sequence_ITT ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_data(...) at test-trial_sequence.R:63:3
    2. └─TrialEmulation::set_data(...)
    3.   └─TrialEmulation (local) .local(object, data, ...)
    4.     ├─methods::callNextMethod(...)
    5.     │ └─base::eval(call, callEnv)
    6.     │   └─base::eval(call, callEnv)
    7.     └─TrialEmulation (local) .nextMethod(...)
    8.       └─TrialEmulation (local) .local(object, data, ...)
    9.         └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   10.           ├─...[]
   11.           └─data.table:::`[.data.table`(...)
  ── Error ('test-trial_sequence.R:78:3'): set_data works for trial_sequence_PP ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_data(...) at test-trial_sequence.R:78:3
    2. └─TrialEmulation::set_data(...)
    3.   └─TrialEmulation (local) .local(object, data, ...)
    4.     ├─methods::callNextMethod(...)
    5.     │ └─base::eval(call, callEnv)
    6.     │   └─base::eval(call, callEnv)
    7.     └─TrialEmulation (local) .nextMethod(...)
    8.       └─TrialEmulation (local) .local(object, data, ...)
    9.         └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   10.           ├─...[]
   11.           └─data.table:::`[.data.table`(...)
  ── Error ('test-trial_sequence.R:94:3'): set_data works for trial_sequence_AT ──
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_data(...) at test-trial_sequence.R:94:3
    2. └─TrialEmulation::set_data(...)
    3.   └─TrialEmulation (local) .local(object, data, ...)
    4.     ├─methods::callNextMethod(...)
    5.     │ └─base::eval(call, callEnv)
    6.     │   └─base::eval(call, callEnv)
    7.     └─TrialEmulation (local) .nextMethod(...)
    8.       └─TrialEmulation (local) .local(object, data, ...)
    9.         └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   10.           ├─...[]
   11.           └─data.table:::`[.data.table`(...)
  ── Error ('test-trial_sequence.R:157:3'): ipw_data works as expected ───────────
  Error in ``[.data.table`(data, , `:=`(after_eligibility, period >= .SD[eligible == 1, min(period, Inf)]), by = id)`: attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_data(...) at test-trial_sequence.R:157:3
    2. └─TrialEmulation::set_data(...)
    3.   └─TrialEmulation (local) .local(object, data, ...)
    4.     ├─methods::callNextMethod(...)
    5.     │ └─base::eval(call, callEnv)
    6.     │   └─base::eval(call, callEnv)
    7.     └─TrialEmulation (local) .nextMethod(...)
    8.       └─TrialEmulation (local) .local(object, data, ...)
    9.         └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   10.           ├─...[]
   11.           └─data.table:::`[.data.table`(...)
  ── Error ('test-trial_sequence.R:185:3'): set_switch_weight_model works for PP ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_switch_weight_model(...) at test-trial_sequence.R:185:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:201:3'): time_on_sequence doesn't get included in numerator ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_error(...) at test-trial_sequence.R:201:3
    2. │ └─testthat:::expect_condition_matching_(...)
    3. │   └─testthat:::quasi_capture(...)
    4. │     ├─testthat (local) .capture(...)
    5. │     │ └─base::withCallingHandlers(...)
    6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    7. ├─TrialEmulation::set_switch_weight_model(...)
    8. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    9. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
   10. │ └─TrialEmulation (local) .local(object, data, ...)
   11. │   ├─methods::callNextMethod(...)
   12. │   │ └─base::eval(call, callEnv)
   13. │   │   └─base::eval(call, callEnv)
   14. │   └─TrialEmulation (local) .nextMethod(...)
   15. │     └─TrialEmulation (local) .local(object, data, ...)
   16. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   17. │         ├─...[]
   18. │         └─data.table:::`[.data.table`(...)
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:216:3'): set_censor_weight_model works for ITT ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_censor_weight_model(...) at test-trial_sequence.R:216:3
    2. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:235:3'): set_censor_weight_model works for PP ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_censor_weight_model(...) at test-trial_sequence.R:235:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:253:3'): time_on_sequence doesn't get included in numerator ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_error(...) at test-trial_sequence.R:253:3
    2. │ └─testthat:::expect_condition_matching_(...)
    3. │   └─testthat:::quasi_capture(...)
    4. │     ├─testthat (local) .capture(...)
    5. │     │ └─base::withCallingHandlers(...)
    6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    7. ├─TrialEmulation::set_censor_weight_model(...)
    8. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    9. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
   10. │ └─TrialEmulation (local) .local(object, data, ...)
   11. │   ├─methods::callNextMethod(...)
   12. │   │ └─base::eval(call, callEnv)
   13. │   │   └─base::eval(call, callEnv)
   14. │   └─TrialEmulation (local) .nextMethod(...)
   15. │     └─TrialEmulation (local) .local(object, data, ...)
   16. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   17. │         ├─...[]
   18. │         └─data.table:::`[.data.table`(...)
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:271:3'): calculate_weights works for ITT with censor weights ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::calculate_weights(...) at test-trial_sequence.R:271:3
    2. ├─TrialEmulation::set_censor_weight_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:318:3'): calculate_weights works for PP with switch_weights ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::calculate_weights(...) at test-trial_sequence.R:318:3
    2. ├─TrialEmulation::set_switch_weight_model(...)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    5. │ └─TrialEmulation (local) .local(object, data, ...)
    6. │   ├─methods::callNextMethod(...)
    7. │   │ └─base::eval(call, callEnv)
    8. │   │   └─base::eval(call, callEnv)
    9. │   └─TrialEmulation (local) .nextMethod(...)
   10. │     └─TrialEmulation (local) .local(object, data, ...)
   11. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   12. │         ├─...[]
   13. │         └─data.table:::`[.data.table`(...)
   14. ├─base::.handleSimpleError(...)
   15. │ └─base (local) h(simpleError(msg, call))
   16. └─base::.handleSimpleError(...)
   17.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:370:3'): calculate_weights works for PP with switch_weights ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'expand_trials': error in evaluating the argument 'object' in selecting a method for function 'set_expansion_options': error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_switch_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::expand_trials(...) at test-trial_sequence.R:370:3
    2. ├─TrialEmulation::set_expansion_options(...)
    3. ├─TrialEmulation::set_outcome_model(...)
    4. ├─TrialEmulation::calculate_weights(...)
    5. ├─TrialEmulation::set_switch_weight_model(...)
    6. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    7. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    8. │ └─TrialEmulation (local) .local(object, data, ...)
    9. │   ├─methods::callNextMethod(...)
   10. │   │ └─base::eval(call, callEnv)
   11. │   │   └─base::eval(call, callEnv)
   12. │   └─TrialEmulation (local) .nextMethod(...)
   13. │     └─TrialEmulation (local) .local(object, data, ...)
   14. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   15. │         ├─...[]
   16. │         └─data.table:::`[.data.table`(...)
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. ├─base::.handleSimpleError(...)
   20. │ └─base (local) h(simpleError(msg, call))
   21. ├─base::.handleSimpleError(...)
   22. │ └─base (local) h(simpleError(msg, call))
   23. ├─base::.handleSimpleError(...)
   24. │ └─base (local) h(simpleError(msg, call))
   25. └─base::.handleSimpleError(...)
   26.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:397:3'): set_outcome_model works for PP with defaults ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:397:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:412:3'): set_outcome_model works for ITT ──────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:412:3
    2. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("ITT"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:427:3'): set_outcome_model works for ATT ──────
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:427:3
    2. ├─TrialEmulation::set_data(trial_sequence("AT"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("AT"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:446:3'): set_outcome_model doesn't work if with unknown variables ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─testthat::expect_error(...) at test-trial_sequence.R:446:3
    2. │ └─testthat:::expect_condition_matching_(...)
    3. │   └─testthat:::quasi_capture(...)
    4. │     ├─testthat (local) .capture(...)
    5. │     │ └─base::withCallingHandlers(...)
    6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    7. ├─TrialEmulation::set_outcome_model(...)
    8. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    9. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
   10. │ └─TrialEmulation (local) .local(object, data, ...)
   11. │   ├─methods::callNextMethod(...)
   12. │   │ └─base::eval(call, callEnv)
   13. │   │   └─base::eval(call, callEnv)
   14. │   └─TrialEmulation (local) .nextMethod(...)
   15. │     └─TrialEmulation (local) .local(object, data, ...)
   16. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   17. │         ├─...[]
   18. │         └─data.table:::`[.data.table`(...)
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:455:3'): set_outcome_model works with strings ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:455:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:466:3'): stabilised weight terms are included in outcome model ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:466:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:505:3'): interaction terms work as expected ───
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:505:3
    2. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    3. ├─TrialEmulation::set_data(trial_sequence("PP"), data_censored)
    4. │ └─TrialEmulation (local) .local(object, data, ...)
    5. │   ├─methods::callNextMethod(...)
    6. │   │ └─base::eval(call, callEnv)
    7. │   │   └─base::eval(call, callEnv)
    8. │   └─TrialEmulation (local) .nextMethod(...)
    9. │     └─TrialEmulation (local) .local(object, data, ...)
   10. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   11. │         ├─...[]
   12. │         └─data.table:::`[.data.table`(...)
   13. └─base::.handleSimpleError(...)
   14.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:529:3'): weights are 1 when not calculated by calculate_weights ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'load_expanded_data': error in evaluating the argument 'object' in selecting a method for function 'expand_trials': error in evaluating the argument 'object' in selecting a method for function 'set_expansion_options': error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': attempt access index 11/11 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::load_expanded_data(...) at test-trial_sequence.R:529:3
    2. ├─TrialEmulation::expand_trials(...)
    3. ├─TrialEmulation::set_expansion_options(...)
    4. ├─TrialEmulation::set_outcome_model(...)
    5. ├─TrialEmulation::set_data(trial_sequence("ITT"), trial_ex)
    6. ├─TrialEmulation::set_data(trial_sequence("ITT"), trial_ex)
    7. │ └─TrialEmulation (local) .local(object, data, ...)
    8. │   ├─methods::callNextMethod(...)
    9. │   │ └─base::eval(call, callEnv)
   10. │   │   └─base::eval(call, callEnv)
   11. │   └─TrialEmulation (local) .nextMethod(...)
   12. │     └─TrialEmulation (local) .local(object, data, ...)
   13. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   14. │         ├─...[]
   15. │         └─data.table:::`[.data.table`(...)
   16. ├─base::.handleSimpleError(...)
   17. │ └─base (local) h(simpleError(msg, call))
   18. ├─base::.handleSimpleError(...)
   19. │ └─base (local) h(simpleError(msg, call))
   20. ├─base::.handleSimpleError(...)
   21. │ └─base (local) h(simpleError(msg, call))
   22. └─base::.handleSimpleError(...)
   23.   └─base (local) h(simpleError(msg, call))
  ── Error ('test-trial_sequence.R:563:3'): load_expanded_data works with trial_sequence objects containing te_datastore_datatable objects ──
  Error in `h(simpleError(msg, call))`: error in evaluating the argument 'object' in selecting a method for function 'set_outcome_model': error in evaluating the argument 'object' in selecting a method for function 'calculate_weights': error in evaluating the argument 'object' in selecting a method for function 'set_censor_weight_model': attempt access index 12/12 in VECTOR_ELT
  Backtrace:
       ▆
    1. ├─TrialEmulation::set_outcome_model(...) at test-trial_sequence.R:563:3
    2. ├─TrialEmulation::calculate_weights(...)
    3. ├─TrialEmulation::set_censor_weight_model(...)
    4. ├─TrialEmulation::set_data(...)
    5. ├─TrialEmulation::set_data(...)
    6. │ └─TrialEmulation (local) .local(object, data, ...)
    7. │   ├─methods::callNextMethod(...)
    8. │   │ └─base::eval(call, callEnv)
    9. │   │   └─base::eval(call, callEnv)
   10. │   └─TrialEmulation (local) .nextMethod(...)
   11. │     └─TrialEmulation (local) .local(object, data, ...)
   12. │       └─TrialEmulation:::data_manipulation(trial_data, use_censor = censor_at_switch)
   13. │         ├─...[]
   14. │         └─data.table:::`[.data.table`(...)
   15. ├─base::.handleSimpleError(...)
   16. │ └─base (local) h(simpleError(msg, call))
   17. ├─base::.handleSimpleError(...)
   18. │ └─base (local) h(simpleError(msg, call))
   19. └─base::.handleSimpleError(...)
   20.   └─base (local) h(simpleError(msg, call))
  
  [ FAIL 55 | WARN 4 | SKIP 22 | PASS 181 ]
  Error:
  ! Test failures.
  Execution halted