Running ‘testthat.R’ [2s/2s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(akiFlagger)
  > 
  > test_check("akiFlagger")
  Saving _problems/test-returnAKIpatients-24.R
  Saving _problems/test-returnAKIpatients-45.R
  Saving _problems/test-returnAKIpatients-71.R
  Saving _problems/test-returnAKIpatients-96.R
  [ FAIL 4 | WARN 0 | SKIP 0 | PASS 2 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-returnAKIpatients.R:24:3'): Patient A - rolling minimum ────────
  Error in ``[.data.table`(df, , `:=`(min_creat48, sapply(.SD[, time], function(x) min(creatinine[between(.SD[, time], x - window1, x)]))), by = patient_id)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─akiFlagger::returnAKIpatients(df) at test-returnAKIpatients.R:24:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test-returnAKIpatients.R:45:3'): Patient A - historical baseline ────
  Error in ``[.data.table`(df, , `:=`(min_creat48, sapply(.SD[, time], function(x) min(creatinine[between(.SD[, time], x - window1, x)]))), by = patient_id)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─akiFlagger::returnAKIpatients(df, HB_trumping = T) at test-returnAKIpatients.R:45:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test-returnAKIpatients.R:71:3'): Patient B - rolling minimum ────────
  Error in ``[.data.table`(df, , `:=`(min_creat48, sapply(.SD[, time], function(x) min(creatinine[between(.SD[, time], x - window1, x)]))), by = patient_id)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─akiFlagger::returnAKIpatients(df, HB_trumping = F) at test-returnAKIpatients.R:71:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test-returnAKIpatients.R:96:3'): Patient B - historical baseline ────
  Error in ``[.data.table`(df, , `:=`(min_creat48, sapply(.SD[, time], function(x) min(creatinine[between(.SD[, time], x - window1, x)]))), by = patient_id)`: attempt access index 4/4 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─akiFlagger::returnAKIpatients(df, HB_trumping = T) at test-returnAKIpatients.R:96:3
   2.   ├─...[]
   3.   └─data.table:::`[.data.table`(...)
  
  [ FAIL 4 | WARN 0 | SKIP 0 | PASS 2 ]
  Error:
  ! Test failures.
  Execution halted