I see two kinds of functions.
- The first to simply grab a statistic from an ARD. This is perhaps already covered by the
get_ard_statistics() function.

- The second would do a bit more because it would also format the statistics and have the ability to return stats in a string. For example, if a user wanted the statistics above, and wanted them returned with Ns and percentages, they could include an argument like
foo(ard, pattern = "{n} / {N} ({p}%)"). The function would apply the formatting function it the ARD to get the stat_fmt column, then using glue, inject for formatted statistics in to a string, e.g. "42 / 86 (49%)". This could be massively helpful for medical writers. They could get an LLM to summarize a table/figure by passing it the JSON representation of the ARD (the LLMs are already good at this). Then request that the LLM replace and statistics with calls to this function so the numbers will dynamically update as more data comes in.
I see two kinds of functions.
get_ard_statistics()function.foo(ard, pattern = "{n} / {N} ({p}%)"). The function would apply the formatting function it the ARD to get thestat_fmtcolumn, then using glue, inject for formatted statistics in to a string, e.g."42 / 86 (49%)". This could be massively helpful for medical writers. They could get an LLM to summarize a table/figure by passing it the JSON representation of the ARD (the LLMs are already good at this). Then request that the LLM replace and statistics with calls to this function so the numbers will dynamically update as more data comes in.