Running ‘testthat.R’ [140s/184s]
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(preventr)
  > 
  > test_check("preventr")
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  this function will not reject extreme values for creatinine.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  this function will not reject extreme values for creatinine.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  this function will not reject extreme values for height and weight.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  this function will not reject extreme values for height and weight.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  although this function checks input validity it just returns `NA`
  with no messaging if it finds a problem.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  Please note: This function was written primarily for internal package use 
  or as part of estimating risk with `estimate_risk()` or `est_risk()`.
  Fitness for more general use has not been tested exhaustively.
  For example, this function implements basic checks of input, but some of
  the input handling is delegated to other processes that are invoked when
  using these functions as aforementioned. To give a more concrete example, 
  although this function checks input validity it just returns `NA`
  with no messaging if it finds a problem.
  That said, the calculations have certainly been tested for accuracy, so 
  if you are confident you understand this caution and in the fidelity of 
  the input you passed to this function, you can proceed judiciously.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model.
  Please check the following required variables: 
  Please check the following required variables: 
  * `age` entered as the invalid column name `trips_around_the_sun` in conjunction with `use_dat = TRUE`; as such, no values were passed for `age`, but must be between 30 and 79 for the PREVENT models
  Please check the following required variables: 
  * `age` entered as the invalid column name `trips_around_the_sun` in conjunction with `use_dat = TRUE`; as such, no values were passed for `age`, but must be between 30 and 79 for the PREVENT models
  Please check the following required variables: 
  * `age` entered as the invalid column name `trips_around_the_sun` in conjunction with `use_dat = TRUE`; as such, no values were passed for `age`, but must be between 30 and 79 for the PREVENT models
  Please check the following required variables: 
  * `age` entered as the invalid column name `trips_around_the_sun` in conjunction with `use_dat = TRUE`; as such, no values were passed for `age`, but must be between 30 and 79 for the PREVENT models
  Please check the following required variables: 
  Please check the following required variables: 
  * `sex` entered as the invalid column name `foo` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sex`, but must be one of "female", "f", "male", "m"
  Please check the following required variables: 
  * `sex` entered as the invalid column name `foo` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sex`, but must be one of "female", "f", "male", "m"
  Please check the following required variables: 
  * `sex` entered as the invalid column name `foo` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sex`, but must be one of "female", "f", "male", "m"
  Please check the following required variables: 
  * `sex` entered as the invalid column name `foo` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sex`, but must be one of "female", "f", "male", "m"
  Please check the following required variables: 
  Please check the following required variables: 
  * `sbp` entered as the invalid column name `blood_pressure` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sbp`, but must be between 90 and 180
  Please check the following required variables: 
  * `sbp` entered as the invalid column name `blood_pressure` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sbp`, but must be between 90 and 180
  Please check the following required variables: 
  * `sbp` entered as the invalid column name `blood_pressure` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sbp`, but must be between 90 and 180
  Please check the following required variables: 
  * `sbp` entered as the invalid column name `blood_pressure` in conjunction with `use_dat = TRUE`; as such, no values were passed for `sbp`, but must be between 90 and 180
  Please check the following required variables: 
  Please check the following required variables: 
  * `bp_tx` entered as the invalid column name `blood_pressure_treatment` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bp_tx`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `bp_tx` entered as the invalid column name `blood_pressure_treatment` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bp_tx`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `bp_tx` entered as the invalid column name `blood_pressure_treatment` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bp_tx`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `bp_tx` entered as the invalid column name `blood_pressure_treatment` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bp_tx`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  Please check the following required variables: 
  * `total_c` entered as the invalid column name `total_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `total_c`, but must be between 130 and 320
  Please check the following required variables: 
  * `total_c` entered as the invalid column name `total_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `total_c`, but must be between 130 and 320
  Please check the following required variables: 
  * `total_c` entered as the invalid column name `total_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `total_c`, but must be between 130 and 320
  Please check the following required variables: 
  * `total_c` entered as the invalid column name `total_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `total_c`, but must be between 130 and 320
  Please check the following required variables: 
  Please check the following required variables: 
  * `hdl_c` entered as the invalid column name `hdl_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hdl_c`, but must be between 20 and 100
  Please check the following required variables: 
  * `hdl_c` entered as the invalid column name `hdl_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hdl_c`, but must be between 20 and 100
  Please check the following required variables: 
  * `hdl_c` entered as the invalid column name `hdl_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hdl_c`, but must be between 20 and 100
  Please check the following required variables: 
  * `hdl_c` entered as the invalid column name `hdl_cholesterol` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hdl_c`, but must be between 20 and 100
  Please check the following required variables: 
  Please check the following required variables: 
  * `statin` entered as the invalid column name `statin_use` in conjunction with `use_dat = TRUE`; as such, no values were passed for `statin`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `statin` entered as the invalid column name `statin_use` in conjunction with `use_dat = TRUE`; as such, no values were passed for `statin`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `statin` entered as the invalid column name `statin_use` in conjunction with `use_dat = TRUE`; as such, no values were passed for `statin`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `statin` entered as the invalid column name `statin_use` in conjunction with `use_dat = TRUE`; as such, no values were passed for `statin`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  Please check the following required variables: 
  * `dm` entered as the invalid column name `diabetes` in conjunction with `use_dat = TRUE`; as such, no values were passed for `dm`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `dm` entered as the invalid column name `diabetes` in conjunction with `use_dat = TRUE`; as such, no values were passed for `dm`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `dm` entered as the invalid column name `diabetes` in conjunction with `use_dat = TRUE`; as such, no values were passed for `dm`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `dm` entered as the invalid column name `diabetes` in conjunction with `use_dat = TRUE`; as such, no values were passed for `dm`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  Please check the following required variables: 
  * `smoking` entered as the invalid column name `smoking_status` in conjunction with `use_dat = TRUE`; as such, no values were passed for `smoking`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `smoking` entered as the invalid column name `smoking_status` in conjunction with `use_dat = TRUE`; as such, no values were passed for `smoking`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `smoking` entered as the invalid column name `smoking_status` in conjunction with `use_dat = TRUE`; as such, no values were passed for `smoking`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  * `smoking` entered as the invalid column name `smoking_status` in conjunction with `use_dat = TRUE`; as such, no values were passed for `smoking`, but must be one of TRUE, 1, FALSE, 0
  Please check the following required variables: 
  Please check the following required variables: 
  * `egfr` entered as the invalid column name `estimated_glomerular_filtration_rate` in conjunction with `use_dat = TRUE`; as such, no values were passed for `egfr`, but must be between 15 and 140
  Please check the following required variables: 
  * `egfr` entered as the invalid column name `estimated_glomerular_filtration_rate` in conjunction with `use_dat = TRUE`; as such, no values were passed for `egfr`, but must be between 15 and 140
  Please check the following required variables: 
  * `egfr` entered as the invalid column name `estimated_glomerular_filtration_rate` in conjunction with `use_dat = TRUE`; as such, no values were passed for `egfr`, but must be between 15 and 140
  Please check the following required variables: 
  * `egfr` entered as the invalid column name `estimated_glomerular_filtration_rate` in conjunction with `use_dat = TRUE`; as such, no values were passed for `egfr`, but must be between 15 and 140
  Please check the following required variables: 
  Please check the following required variables: 
  * `bmi` entered as the invalid column name `body_mass_index` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bmi`, but must be between 18.5 and 39.9
  Please check the following required variables: 
  * `bmi` entered as the invalid column name `body_mass_index` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bmi`, but must be between 18.5 and 39.9
  Please check the following required variables: 
  * `bmi` entered as the invalid column name `body_mass_index` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bmi`, but must be between 18.5 and 39.9
  Please check the following required variables: 
  * `bmi` entered as the invalid column name `body_mass_index` in conjunction with `use_dat = TRUE`; as such, no values were passed for `bmi`, but must be between 18.5 and 39.9
  Please check the following optional variables: 
  Please check the following optional variables: 
  * `hba1c` entered as the invalid column name `sugar` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hba1c`, but must be between 4.5 and 15
  Please check the following optional variables: 
  * `hba1c` entered as the invalid column name `sugar` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hba1c`, but must be between 4.5 and 15
  Please check the following optional variables: 
  * `hba1c` entered as the invalid column name `sugar` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hba1c`, but must be between 4.5 and 15
  Please check the following optional variables: 
  * `hba1c` entered as the invalid column name `sugar` in conjunction with `use_dat = TRUE`; as such, no values were passed for `hba1c`, but must be between 4.5 and 15
  Please check the following optional variables: 
  Please check the following optional variables: 
  * `uacr` entered as the invalid column name `protein` in conjunction with `use_dat = TRUE`; as such, no values were passed for `uacr`, but must be between 0.1 and 25000
  Please check the following optional variables: 
  * `uacr` entered as the invalid column name `protein` in conjunction with `use_dat = TRUE`; as such, no values were passed for `uacr`, but must be between 0.1 and 25000
  Please check the following optional variables: 
  * `uacr` entered as the invalid column name `protein` in conjunction with `use_dat = TRUE`; as such, no values were passed for `uacr`, but must be between 0.1 and 25000
  Please check the following optional variables: 
  * `uacr` entered as the invalid column name `protein` in conjunction with `use_dat = TRUE`; as such, no values were passed for `uacr`, but must be between 0.1 and 25000
  Please check the following optional variables: 
  Please check the following optional variables: 
  * `zip` entered as the invalid column name `where_are_you` in conjunction with `use_dat = TRUE`; as such, no values were passed for `zip`
  Please check the following optional variables: 
  * `zip` entered as the invalid column name `where_are_you` in conjunction with `use_dat = TRUE`; as such, no values were passed for `zip`
  Please check the following optional variables: 
  * `zip` entered as the invalid column name `where_are_you` in conjunction with `use_dat = TRUE`; as such, no values were passed for `zip`
  Please check the following optional variables: 
  * `zip` entered as the invalid column name `where_are_you` in conjunction with `use_dat = TRUE`; as such, no values were passed for `zip`
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding SDI.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding SDI.
  Saving _problems/test-prevent_equations-2512.R
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |=======                                                               |  10%
    |                                                                            
    |==============                                                        |  20%
    |                                                                            
    |=====================                                                 |  30%
    |                                                                            
    |============================                                          |  40%
    |                                                                            
    |===================================                                   |  50%
    |                                                                            
    |==========================================                            |  60%
    |                                                                            
    |=================================================                     |  70%
    |                                                                            
    |========================================================              |  80%
    |                                                                            
    |===============================================================       |  90%
    |                                                                            
    |======================================================================| 100%
  Saving _problems/test-prevent_equations-2521.R
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  PREVENT estimates are from: Base model adding SDI.
  Please check the following optional variables: 
  PREVENT estimates are from: Base model adding SDI.
  Please check the following optional variables: 
  * `hba1c` entered as 8675309, but must be between 4.5 and 15 (so set to NULL)
  Please check the following optional variables: 
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  Please check the following optional variables: 
  * `hba1c` entered as 8675309, but must be between 4.5 and 15 (so set to NULL)
  Please check the following optional variables: 
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  Please check the following optional variables: 
  * `hba1c` entered as 8675309, but must be between 4.5 and 15 (so set to NULL)
  Please check the following optional variables: 
  Please check the following optional variables: 
  PREVENT estimates are from: Base model adding SDI.
  Please check the following optional variables: 
  * `hba1c` entered as 8675309, but must be between 4.5 and 15 (so set to NULL)
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding UACR.
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  PREVENT estimates are from: Base model adding SDI.
  PREVENT estimates are from: Base model.
  PREVENT estimates are from: Base model adding HbA1c.
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  PREVENT estimates are from: Base model adding HbA1c, SDI, and UACR (also referred to as the full model).
  PREVENT estimates are from: Base model adding UACR.
  PREVENT estimates are from: Base model.
  [ FAIL 2 | WARN 2 | SKIP 59 | PASS 823 ]
  
  ══ Skipped tests (59) ══════════════════════════════════════════════════════════
  • On CRAN (59): 'test-helpers_test.R:186:1', 'test-helpers_test.R:225:1',
    'test-other_models.R:1023:3', 'test-prevent_equations.R:292:1',
    'test-prevent_equations.R:296:1', 'test-prevent_equations.R:302:1',
    'test-prevent_equations.R:366:1', 'test-prevent_equations.R:370:1',
    'test-prevent_equations.R:374:1', 'test-prevent_equations.R:380:1',
    'test-prevent_equations.R:384:1', 'test-prevent_equations.R:392:1',
    'test-prevent_equations.R:396:1', 'test-prevent_equations.R:404:1',
    'test-prevent_equations.R:408:1', 'test-prevent_equations.R:414:1',
    'test-prevent_equations.R:418:1', 'test-prevent_equations.R:424:1',
    'test-prevent_equations.R:428:1', 'test-prevent_equations.R:434:1',
    'test-prevent_equations.R:438:1', 'test-prevent_equations.R:442:1',
    'test-prevent_equations.R:446:1', 'test-prevent_equations.R:450:1',
    'test-prevent_equations.R:463:1', 'test-prevent_equations.R:467:1',
    'test-prevent_equations.R:471:1', 'test-prevent_equations.R:475:1',
    'test-prevent_equations.R:479:1', 'test-prevent_equations.R:483:1',
    'test-prevent_equations.R:487:1', 'test-prevent_equations.R:491:1',
    'test-prevent_equations.R:496:1', 'test-prevent_equations.R:589:1',
    'test-prevent_equations.R:593:1', 'test-prevent_equations.R:597:1',
    'test-prevent_equations.R:606:1', 'test-prevent_equations.R:615:1',
    'test-prevent_equations.R:624:1', 'test-prevent_equations.R:633:1',
    'test-prevent_equations.R:642:1', 'test-prevent_equations.R:656:1',
    'test-prevent_equations.R:675:1', 'test-prevent_equations.R:695:1',
    'test-prevent_equations.R:715:1', 'test-prevent_equations.R:745:1',
    'test-prevent_equations.R:941:1', 'test-prevent_equations.R:960:1',
    'test-prevent_equations.R:980:1', 'test-prevent_equations.R:1000:1',
    'test-prevent_equations.R:1030:1', 'test-prevent_equations.R:1249:1',
    'test-prevent_equations.R:1461:1', 'test-prevent_equations.R:1578:1',
    'test-prevent_equations.R:1598:1', 'test-prevent_equations.R:1618:1',
    'test-prevent_equations.R:1638:1', 'test-prevent_equations.R:1837:1',
    'test-prevent_equations.R:3345:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-prevent_equations.R:2512:3'): args `use_dat` and `add_to_dat` behave as intended, `chol_unit` var ──
  Expected `count_nas_from_res(res)` to equal 0.
  Differences:
    `actual`: 28.0
  `expected`:  0.0
  
  ── Failure ('test-prevent_equations.R:2521:3'): args `use_dat` and `add_to_dat` behave as intended, `chol_unit` var ──
  Expected `count_nas_from_res(res)` to equal `10 * sum(dat[["chol_unit"]] == "mmol/L")`.
  Differences:
    `actual`: 56.0
  `expected`: 40.0
  
  
  [ FAIL 2 | WARN 2 | SKIP 59 | PASS 823 ]
  Error:
  ! Test failures.
  Execution halted