Running ‘testthat.R’ [45s/134s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(NHSRwaitinglist)
  > 
  > test_check("NHSRwaitinglist")
  Saving _problems/test-sim_patients-3.R
  Saving _problems/test-sim_patients-9.R
  Saving _problems/test-sim_patients-20.R
  Saving _problems/test-sim_patients-26.R
  Saving _problems/test-sim_patients-40.R
  Saving _problems/test-sim_patients-48.R
  Saving _problems/test-sim_patients-54.R
  Saving _problems/test-wl_simulator-34.R
  [ FAIL 8 | WARN 0 | SKIP 0 | PASS 395 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-sim_patients.R:3:3'): sim_patients generates the correct number of rows ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:3:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:9:3'): sim_patients returns the correct columns ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:9:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:20:3'): sim_patients handles missing start_date by using Sys.Date() ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 5) at test-sim_patients.R:20:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:26:3'): sim_patients assigns valid priority values ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:26:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:40:13'): sim_patients initializes 'Referral', 'Removal'
            , and 'Withdrawal' as NA ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:40:13
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:48:3'): sim_patients assigns valid NHS numbers ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:48:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-sim_patients.R:54:3'): sim_patients generates random names for patients ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::sim_patients(n_rows = 10) at test-sim_patients.R:54:3
   2.   └─randomNames::randomNames(n_rows)
   3.     ├─...[]
   4.     └─data.table:::`[.data.table`(...)
  ── Error ('test-wl_simulator.R:33:3'): wl_simulator works with detailed_sim = TRUE ──
  Error in ``[.data.table`(tmp.dt, , `:=`(first_name, first_names(gender, ethnicity, .N)), by = list(gender, ethnicity))`: attempt access index 3/3 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─NHSRwaitinglist::wl_simulator(...) at test-wl_simulator.R:33:3
   2.   └─NHSRwaitinglist::sim_patients(length(referral), start_date)
   3.     └─randomNames::randomNames(n_rows)
   4.       ├─...[]
   5.       └─data.table:::`[.data.table`(...)
  
  [ FAIL 8 | WARN 0 | SKIP 0 | PASS 395 ]
  Error:
  ! Test failures.
  Execution halted