The {cards} package exports many utilities for working with ARD objects. Additionally, {cards} exports utilities for creating new ard_*() functions. The {cardx} package takes advantage of this infrastructure, and exports many other functions for creating more complex ARD objects.
Utilizing these utilities from {cards}, we can easily create a function to prepare the results from a t-test.
cards::ADSL |># keep two treatment arms for the t-test calculation dplyr::filter(ARM %in%c("Placebo", "Xanomeline High Dose")) |> cardx::ard_stats_t_test(by = ARM, variables = AGE)
{cards} data frame: 14 x 9
group1 variable context stat_name stat_label stat
1 ARM AGE stats_t_… estimate Mean Dif… 0.828
2 ARM AGE stats_t_… estimate1 Group 1 … 75.209
3 ARM AGE stats_t_… estimate2 Group 2 … 74.381
4 ARM AGE stats_t_… statistic t Statis… 0.655
5 ARM AGE stats_t_… p.value p-value 0.513
6 ARM AGE stats_t_… parameter Degrees … 167.362
7 ARM AGE stats_t_… conf.low CI Lower… -1.668
8 ARM AGE stats_t_… conf.high CI Upper… 3.324
9 ARM AGE stats_t_… method method Welch Tw…
10 ARM AGE stats_t_… alternative alternat… two.sided
11 ARM AGE stats_t_… mu H0 Mean 0
12 ARM AGE stats_t_… paired Paired t… FALSE
13 ARM AGE stats_t_… var.equal Equal Va… FALSE
14 ARM AGE stats_t_… conf.level CI Confi… 0.95
ℹ 3 more variables: fmt_fn, warning, error
The utilities allow us to return, not only the results of the t-test, but rows for each of the arguments. This allows us to both report the results, and also in a re-use case, know exactly how the results were calculated, e.g. assuming equal variances, the level of the confidence interval, etc.
Essentially, every new ard_*() function we write, will be added to {cardx} rather than {cards}.
For our ARD work, we will take advantage of the {broom} package and we will use the naming conventions from {broom}. The {broom} package get 500K+ installs every month. With an enormous user base, we can be confident in the results.