Running ‘testthat.R’ [2s/4s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(polypharmacy)
  > 
  > test_check("polypharmacy")
  
  Attaching package: 'data.table'
  
  The following object is masked from 'package:base':
  
      %notin%
  
  Saving _problems/test-data_process-87.R
  Saving _problems/test-data_process-119.R
  Saving _problems/test-data_process-146.R
  Saving _problems/test-data_process-167.R
  Saving _problems/test-data_process-221.R
  Saving _problems/test-data_process-259.R
  Saving _problems/test-data_process-292.R
  Saving _problems/test-data_process-336.R
  Saving _problems/test-data_process-388.R
  Saving _problems/test-ind_simult-17.R
  Saving _problems/test-ind_stdcontinuous-13.R
  Saving _problems/test-ind_stdcumul-17.R
  Saving _problems/test-ind_ucontinuous-17.R
  Saving _problems/test-ind_wcumul-17.R
  [ FAIL 14 | WARN 0 | SKIP 0 | PASS 18 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-data_process.R:68:3'): data_process.hosp_stays ─────────────────
  Error in ``[.data.table`(Rx_deliv, sunique(c(idx, idx + 1)), `:=`(by_hosp, cumsum(hosp)), .(id, drug_code))`: attempt access index 7/7 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:68:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:102:3'): data_process.hosp_stays_many ───────────
  Error in ``[.data.table`(Hosp_stays, idx, `:=`(diff, tx_start - shift(tx_end)), .(id))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:102:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─Hosp_stays[idx, `:=`(diff, tx_start - shift(tx_end)), .(id)]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:133:3'): data_process.hosp_stays_more_many ──────
  Error in ``[.data.table`(Hosp_stays, idx, `:=`(diff, tx_start - shift(tx_end)), .(id))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:133:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─Hosp_stays[idx, `:=`(diff, tx_start - shift(tx_end)), .(id)]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:157:3'): data_process.study_dates ───────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:157:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:209:3'): data_process.grace_factr ───────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:209:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:250:3'): data_process.grace_cst ─────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:250:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:283:3'): data_process.grace_fctr_cst ────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:283:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:324:3'): data_process.max_reserve ───────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:324:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─...[]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-data_process.R:375:3'): data_process.hospit_grace ──────────────
  Error in ``[.data.table`(Hosp_stays, idx, `:=`(diff, tx_start - shift(tx_end)), .(id))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test-data_process.R:375:3
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─polypharmacy::data_process(...)
   5.   └─polypharmacy::data_process.1_core(...)
   6.     ├─Hosp_stays[idx, `:=`(diff, tx_start - shift(tx_end)), .(id)]
   7.     └─data.table:::`[.data.table`(...)
  ── Error ('test-ind_simult.R:13:3'): ind_simult ────────────────────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─polypharmacy::data_process(...) at test-ind_simult.R:13:3
   2.   └─polypharmacy::data_process.1_core(...)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-ind_stdcontinuous.R:9:3'): ind_stdcontinuous ───────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─polypharmacy::data_process(...) at test-ind_stdcontinuous.R:9:3
   2.   └─polypharmacy::data_process.1_core(...)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-ind_stdcumul.R:13:3'): ind_stdcumul ────────────────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─polypharmacy::data_process(...) at test-ind_stdcumul.R:13:3
   2.   └─polypharmacy::data_process.1_core(...)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-ind_ucontinuous.R:13:3'): ind_ucontinuous ──────────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─polypharmacy::data_process(...) at test-ind_ucontinuous.R:13:3
   2.   └─polypharmacy::data_process.1_core(...)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-ind_wcumul.R:13:3'): ind_wcumul ────────────────────────────────
  Error in ``[.data.table`(Rx_deliv, Rx_deliv[, .I[.N > 1], .(id, drug_code)]$V1, `:=`(diff, tx_start - shift(tx_end) - 1L), .(id, drug_code))`: attempt access index 6/6 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─polypharmacy::data_process(...) at test-ind_wcumul.R:13:3
   2.   └─polypharmacy::data_process.1_core(...)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  
  [ FAIL 14 | WARN 0 | SKIP 0 | PASS 18 ]
  Error:
  ! Test failures.
  Execution halted