gtsummary
gtsummary copied to clipboard
In some cases, warnings during `add_p()` are printed twice
library(gtsummary)
packageVersion("gtsummary")
#> [1] '2.0.1.9011'
tmax <- data.frame(Subject = c(1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 5, 5, 5, 5),
Treatment = c("T", "R", "T", "R", "R", "T", "R", "T", "T", "R", "T", "R", "R", "T", "R", "T"),
TMAX = c(1.333, 1.667, 0.667, 1.667, 2, 0.667, 2, 2, 1, 1, 2, 1, 0.667, 1, 2, 1))
tmax |>
tbl_summary(
by = Treatment,
include = -Subject,
missing = 'no',
type = list(TMAX ~ "continuous")
) |>
add_p(
test = list(all_continuous() ~ "paired.wilcox.test"),
group = Subject
) |>
as_kable()
#> The following warning was returned in `add_p()` for variable "TMAX"
#> ! Values from `TMAX` are not uniquely identified; output will contain
#> list-cols. • Use `values_fn = list` to suppress this warning. • Use
#> `values_fn = {summary_fun}` to summarise duplicates. • Use the following
#> dplyr code to identify duplicates. {data} |> dplyr::summarise(n =
#> dplyr::n(), .by = c(Subject, Treatment)) |> dplyr::filter(n > 1L)
#> The following errors were returned during `as_kable()`:
#> ✖ For variable `TMAX` (`Treatment`) and "statistic" and "p.value" statistics:
#> 'x' must be numeric
#> The following warnings were returned during `as_kable()`:
#> ! For variable `TMAX` (`Treatment`) and "statistic" and "p.value" statistics:
#> Values from `TMAX` are not uniquely identified; output will contain
#> list-cols. • Use `values_fn = list` to suppress this warning. • Use
#> `values_fn = {summary_fun}` to summarise duplicates. • Use the following
#> dplyr code to identify duplicates. {data} |> dplyr::summarise(n =
#> dplyr::n(), .by = c(Subject, Treatment)) |> dplyr::filter(n > 1L)
Characteristic | R N = 8 | T N = 8 | p-value |
---|---|---|---|
TMAX | 1.67 (1.00, 2.00) | 1.00 (0.83, 1.67) |
Created on 2024-08-31 with reprex v2.1.1