GSK-Biostatistics / tfrmt

r package for formatting tables
https://gsk-biostatistics.github.io/tfrmt/
Other
70 stars 8 forks source link

CRAN R CMD check errors with upcoming gt release (v0.11.1) #477

Closed rich-iannone closed 1 month ago

rich-iannone commented 1 month ago

Hello, I'm in the process of submitting gt (v0.11.1) to CRAN and their reverse dependency checks brought up an error when checking tfrmt. Here is the full check statement from a CRAN email:

Changes to worse in reverse depends:

Package: tfrmt
Check: tests
New result: ERROR
   Running ‘testthat.R’ [36s/37s]
 Running the tests in ‘tests/testthat.R’ failed.
 Complete output:
library(testthat)
library(tfrmt)

test_check("tfrmt")
   Writing json file out to:
   test.json
   The following rows of the given dataset have no format applied to them 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
   The following rows of the given dataset have no format applied to them 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
   [ FAIL 1 | WARN 0 | SKIP 10 | PASS 545 ]

   ══ Skipped tests (10) ══════════════════════════════════════════════════════════
   • On CRAN (10): 'test-JSON.R:4:3', 'test-JSON.R:39:3', 'test-JSON.R:58:3',
     'test-JSON.R:94:3', 'test-JSON.R:268:3', 'test-JSON.R:287:3',
     'test-JSON.R:346:3', 'test-JSON.R:446:3', 'test-JSON.R:478:3',
     'test-make_mock_data.R:226:3'

   ══ Failed tests ════════════════════════════════════════════════════════════════
   ── Failure ('test-big_ns.R:508:3'): Test big n with footnotes ──────────────────
   big_n_footnote_plan_gt$`_footnotes` %>% ... (`actual`) not equal to tibble(...) (`expected`).

   `class(actual)`:   "data.frame"                   
   `class(expected)`: "tbl_df"     "tbl" "data.frame"

   [ FAIL 1 | WARN 0 | SKIP 10 | PASS 545 ]
   Error: Test failures
   Execution halted

Seems like only a single error and I'm happy to help out if something is strange on the gt side.

olivroy commented 1 month ago

This is my fault! For performance, we decided to store most internal objects in gt as data frames instead of tibbles.

https://github.com/GSK-Biostatistics/tfrmt/blob/4060b9b01205fb217a17519fa1d581d405007143/tests/testthat/test-big_ns.R#L508-L548

At line 511, if you change tibble -> data.frame, the test will pass once again.

bzkrouse commented 1 month ago

Thanks @rich-iannone and @olivroy for the notice!

bzkrouse commented 1 month ago

fixed in v0.1.3!