tests/testthat/_snaps/add_n.tbl_summary.md

add_n.tbl_summary() works

Code
  as.data.frame(add_n(tbl_summary(trial, include = c(age, grade, response)),
  statistic = "{N_nonmiss} / {N_obs}", footnote = TRUE, last = TRUE))
Output
    **Characteristic** **N = 200**     **N**
  1                Age 47 (38, 57) 189 / 200
  2            Unknown          11      <NA>
  3              Grade        <NA> 200 / 200
  4                  I    68 (34%)      <NA>
  5                 II    68 (34%)      <NA>
  6                III    64 (32%)      <NA>
  7     Tumor Response    61 (32%) 193 / 200
  8            Unknown           7      <NA>

add_n.tbl_summary(statistic) error messaging

Code
  add_n(tbl_summary(trial, by = trt, include = c(trt, age, grade, response)),
  statistic = "no_curlies")
Condition
  Error in `add_n()`:
  ! No glue elements found in the `statistic` argument ("no_curlies").
  i Do you need to wrap the statistic name in curly brackets, e.g. "{N_nonmiss}"?
Code
  add_n(tbl_summary(trial, by = trt, include = c(trt, age, grade, response)),
  statistic = "{not_a_stat}")
Condition
  Error in `add_n()`:
  ! The following statistics are not valid for the `statistic` argument: "not_a_stat".
  i Select from "N_obs", "N_miss", "N_nonmiss", "p_miss", and "p_nonmiss".


Try the gtsummary package in your browser

Any scripts or data that you put into this service are public.

gtsummary documentation built on Oct. 5, 2024, 1:06 a.m.