Running ‘testthat.R’ [175s/195s]
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(gtregression)
  > 
  > test_check("gtregression")
  
  Attaching package: 'dplyr'
  
  The following objects are masked from 'package:stats':
  
      filter, lag
  
  The following objects are masked from 'package:base':
  
      intersect, setdiff, setequal, union
  
  Saving _problems/test-descriptive_table-122.R
  Saving _problems/test-descriptive_table-123.R
  # A tibble: 18 x 6
     Variable     Type    `Missing (%)` Unique Levels                Compatibility
     <chr>        <chr>   <chr>          <int> <chr>                 <chr>        
   1 pregnant     numeric 0%                17 -                     compatible   
   2 glucose      numeric 0.7%             135 -                     compatible   
   3 pressure     numeric 4.6%              46 -                     compatible   
   4 triceps      numeric 29.6%             50 -                     compatible   
   5 insulin      numeric 48.7%            185 -                     compatible   
   6 mass         numeric 1.4%             247 -                     compatible   
   7 pedigree     numeric 0%               517 -                     compatible   
   8 age          numeric 0%                52 -                     compatible   
   9 diabetes     numeric 0%                 2 -                     maybe        
  10 bmi          factor  1.4%               3 Normal, Overweight, ~ compatible   
  11 age_cat      factor  0%                 3 Young, Middle-aged, ~ compatible   
  12 npreg_cat    factor  0%                 2 Low parity, High par~ compatible   
  13 glucose_cat  factor  0.7%               2 Normal, High          compatible   
  14 bp_cat       factor  4.6%               2 Normal, High          compatible   
  15 triceps_cat  factor  29.6%              2 Normal, High          compatible   
  16 insulin_cat  factor  48.7%              3 Low, Normal, High     compatible   
  17 dpf_cat      factor  0%                 3 Low Genetic Risk, Mo~ compatible   
  18 diabetes_cat factor  0%                 2 Diabetes negative, D~ compatible   
  
  Interpretation notes:
  - compatible: ready to use in regression
  - maybe: require transformation to factor or check no of levels
  - incompatible: not usable as-is (e.g., all NA, <2 levels)
  
  
  ------------------------------------------------------------
  
  Crude Estimate:      2.961
  
  Adjusted Estimate:   2.496
  
  % Change from Crude: 15.69%
  
  ------------------------------------------------------------
  
  Confounding:         Yes
  
  ------------------------------------------------------------
  
  Notes:
  
  * Confounding is suggested if percent change >=10%.
  
  * This method does not assess effect modification.
  
  * Use DAGs or domain knowledge to support confounder identification.
  
  # A tibble: 4 x 5
    covariate crude_est adjusted_est pct_change is_confounder
    <chr>         <dbl>        <dbl>      <dbl> <lgl>        
  1 bmi            2.96         2.50      15.7  TRUE         
  2 age_cat        2.96         2.62      11.5  TRUE         
  3 npreg_cat      2.96         2.78       6.07 FALSE        
  4 bp_cat         2.96        NA         NA    NA           
  
  Notes:
  
  * Confounding is suggested if percent change >=10%.
  
  * This method does not assess effect modification.
  
  * Use DAGs or domain knowledge to support confounder
          identification.
  
  
  ------------------------------------------------------------
  
  Crude Estimate:      2.961
  
  Adjusted Estimate:   NA
  
  % Change from Crude: NA%
  
  ------------------------------------------------------------
  
  Confounding:         NA
  
  ------------------------------------------------------------
  
  Notes:
  
  * Confounding is suggested if percent change >=10%.
  
  * This method does not assess effect modification.
  
  * Use DAGs or domain knowledge to support confounder identification.
  
  # A tibble: 4 x 5
    covariate crude_est adjusted_est pct_change is_confounder
    <chr>         <dbl>        <dbl>      <dbl> <lgl>        
  1 bmi            2.96           NA         NA NA           
  2 age_cat        2.96           NA         NA NA           
  3 npreg_cat      2.96           NA         NA NA           
  4 bp_cat         2.96           NA         NA NA           
  
  Notes:
  
  * Confounding is suggested if percent change >=10%.
  
  * This method does not assess effect modification.
  
  * Use DAGs or domain knowledge to support confounder
          identification.
  
  # A tibble: 3 x 5
    covariate crude_est adjusted_est pct_change is_confounder
    <chr>         <dbl>        <dbl>      <dbl> <lgl>        
  1 Eth            1.18         1.24       4.98 FALSE        
  2 Age            1.18         1.01      14.5  TRUE         
  3 Lrn            1.18         1.21       2.37 FALSE        
  
  Notes:
  
  * Confounding is suggested if percent change >=10%.
  
  * This method does not assess effect modification.
  
  * Use DAGs or domain knowledge to support confounder
          identification.
  
  ---------------------------------------------------
  
  Interaction Term Assessment usingLikelihood Ratio Test
  
  Model without interaction:
     diabetes ~ age_cat + glucose_cat
  
  Model with interaction:
     diabetes ~ age_cat + glucose_cat + age_cat:glucose_cat
  
  -----------------------------------------------------
  
  P-value:0.1741
  
  Interaction is not statistically significant.
        Simpler model may be preferred.
  
  ----------------------------------------------------
  
  ---------------------------------------------------
  
  Interaction Term Assessment usingLikelihood Ratio Test
  
  Model without interaction:
     diabetes ~ age_cat + glucose_cat
  
  Model with interaction:
     diabetes ~ age_cat + glucose_cat + age_cat:glucose_cat
  
  -----------------------------------------------------
  
  P-value:0.0100
  
  Interaction is statistically significant. Consider including it.
  
  ----------------------------------------------------
  
  The number rows in the tables to be merged do not match, which may result in rows appearing out of order.
  i See `tbl_merge()` (`?gtsummary::tbl_merge()`) help file for details. Use `quiet=TRUE` to silence message.
  The number rows in the tables to be merged do not match, which may result in rows appearing out of order.
  i See `tbl_merge()` (`?gtsummary::tbl_merge()`) help file for details. Use `quiet=TRUE` to silence message.
  robpoisson: Implausible predicted probability >0.99999 occurred: 1.20967417078353
  robpoisson: Implausible predicted probability >0.99999 occurred: 1.27352337518945
  Table saved at: /tmp/RtmpmlddHP/regression_results.docx
  `height` was translated to `width`.
  Plot saved at: /tmp/RtmpmlddHP/plot_png.png
  `height` was translated to `width`.
  Plot saved at: /tmp/RtmpmlddHP/plot_pdf.pdf
  `height` was translated to `width`.
  Plot saved at: /tmp/RtmpmlddHP/plot_jpg.jpg
  `height` was translated to `width`.
  Word document saved at: /tmp/RtmpmlddHP/final_report.docx
  If tables or plots extend beyond the page, consider switching to landscape layout in Word (Layout > Orientation > Landscape).
  
  Attaching package: 'MASS'
  
  The following object is masked from 'package:gtsummary':
  
      select
  
  The following object is masked from 'package:dplyr':
  
      select
  
  Running stratified multivariable regression by: glucose_cat
    > Stratum: glucose_cat = High
    > Stratum: glucose_cat = Normal
  Running stratified multivariable regression by: glucose_cat
    > Stratum: glucose_cat = Normal
    > Stratum: glucose_cat = High
  Running stratified multivariable regression by: glucose_cat
    > Stratum: glucose_cat = High
    > Stratum: glucose_cat = Normal
  Running stratified multivariable regression by: glucose_cat
    > Stratum: glucose_cat = High
  x There was an error calling `tidy_fun()`. Most likely, this is because the
  function supplied in `tidy_fun=` was misspelled, does not exist, is not
  compatible with your object, or was missing necessary arguments (e.g. `conf.level=` or `conf.int=`). See error message below.
    > Stratum: glucose_cat = Normal
  x There was an error calling `tidy_fun()`. Most likely, this is because the
  function supplied in `tidy_fun=` was misspelled, does not exist, is not
  compatible with your object, or was missing necessary arguments (e.g. `conf.level=` or `conf.int=`). See error message below.
  Error: No valid models across strata.
  Running stratified univariate regression by: glucose_cat
    > Stratum: glucose_cat = High
    > Stratum: glucose_cat = Normal
  Running stratified univariate regression by: glucose_cat
    > Stratum: glucose_cat = Normal
    > Stratum: glucose_cat = High
  Running stratified univariate regression by: glucose_cat
    > Stratum: glucose_cat = High
    > Stratum: glucose_cat = Normal
  Running stratified univariate regression by: age_cat
    > Stratum: age_cat = Older
    > Stratum: age_cat = Middle-aged
    > Stratum: age_cat = Young
  Running stratified univariate regression by: glucose_cat
  
  Call:  glm(formula = formula, family = binomial("logit"), data = data)
  
  Coefficients:
  (Intercept)      glucose  
     -6.09552      0.04242  
  
  Degrees of Freedom: 391 Total (i.e. Null);  390 Residual
  Null Deviance:	    498.1 
  Residual Deviance: 386.7 	AIC: 390.7
  [ FAIL 2 | WARN 21 | SKIP 3 | PASS 238 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN (2): 'test-dissect.R:1:1', 'test-multi_reg.R:62:7'
  • Skipping test: No valid models across strata for negbin. (1):
    'test-stratified_multi_reg.R:188:5'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-descriptive_table.R:113:3'): descriptive_table works with row percentages ──
  Expected `... <- NULL` not to throw any errors.
  Actually got a <simpleError> with message:
    row names contain missing values
  Backtrace:
       ▆
    1. ├─testthat::expect_error(...) at test-descriptive_table.R:113: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. ├─gtregression::descriptive_table(...)
    8. │ ├─gtsummary::add_overall(...)
    9. │ └─gtsummary:::add_overall.tbl_summary(...)
   10. │   └─gtsummary:::add_overall_generic(...)
   11. │     ├─base::do.call(calling_fun, args_overall)
   12. │     └─gtsummary::tbl_summary(...)
   13. │       ├─cards::replace_null_statistic(...)
   14. │       │ └─cards:::check_class(x, "card")
   15. │       ├─... %>% structure(., class = c("card", class(.)))
   16. │       ├─cards::bind_ard(...)
   17. │       │ └─dplyr::bind_rows(...)
   18. │       │   └─rlang::list2(...)
   19. │       ├─cards::ard_tabulate(...)
   20. │       └─cards:::ard_tabulate.data.frame(...)
   21. │         └─cards:::.calculate_tabulation_statistics(...)
   22. │           └─cards:::.process_denominator(...)
   23. │             ├─stats::setNames(...)
   24. │             └─base::lapply(...)
   25. │               └─cards (local) FUN(X[[i]], ...)
   26. │                 ├─dplyr::summarise(...)
   27. │                 ├─tidyr::drop_na(...)
   28. │                 └─cards:::.table_as_df(...)
   29. │                   ├─dplyr::as_tibble(...)
   30. │                   └─tibble:::as_tibble.table(...)
   31. │                     ├─base::as.data.frame(x, stringsAsFactors = FALSE)
   32. │                     └─base::as.data.frame.table(x, stringsAsFactors = FALSE)
   33. │                       ├─base::eval(ex)
   34. │                       │ └─base::eval(ex)
   35. │                       └─base::data.frame(...)
   36. │                         ├─base::as.data.frame(x[[i]], optional = TRUE)
   37. │                         └─base::as.data.frame.integer(x[[i]], optional = TRUE)
   38. └─base::structure(., class = c("card", class(.)))
  ── Failure ('test-descriptive_table.R:123:3'): descriptive_table works with row percentages ──
  Expected `tbl` to be an S3 object.
  Actual OO type: none.
  
  [ FAIL 2 | WARN 21 | SKIP 3 | PASS 238 ]
  Error:
  ! Test failures.
  Execution halted