[R] How would you program an Adverse Events statistical table using R code?

Ista Zahn istazahn at gmail.com
Sat Feb 25 16:18:48 CET 2012

Hi Robert,

I think you might find it helpful to start with 


On Friday, February 24, 2012 07:13:10 PM Robert Wilkins wrote:
> A graph != A table.
> I'm talking about a page full of summary statistics and advanced
> statistics, with lots of cross categories on the top and left margin
> of the table, as opposed to a visual display with x-axis and y-axis,
> which is totally different.
> (An example of how this is done in another language is available  at
> http://fivetimesfaster.blogspot.com )
> For an AE table, you have an N and % column for every treatment group,
> and for all patients combined. On the right side, a categorical
> p-value (chi-sq or Fisher's) for every preferred term (every row!
> forget multiple testing issues, this is what the boss is asking
> for(it's ad-hoc safety analysis))
> There's a row for grand total N for each group.
> A row for N and % of patients with any event (regardless of body
> system and preferred term)
> For each body system, there's a section of rows that include:
>   A row for N and % of patients with any event (this body system)
>   A row for N and % of patients who do NOT have an event( this body system)
>   And , of course, within body system, a row for each preferred term
> (again N and % for each group , and also the p-value)
> Body system and preferred term are, of course broad medical category
> and specific medical category.
> In the Pharma industry, they use the SAS programming language. Each
> table often needs several hundred lines of code. Essentially it's a
> combination of analysis and (visual)-reporting mixed together, with
> some prerequisite data transformation. (And yes, with this new
> language, it can be done in under 20 lines of code).
> I have not seen people discuss attempts to do such things with the R
> programming language, and how successful such attempts have been. How
> hard is it, how much code is it?
> In general, we are talking about a variety of complex,
> somewhat-nonhomogeneous statistical tables with a variety of different
> row sections and row categories, and different column sections and
> column categories, and a mixture of summary statistics and advanced
> statistics (p-value , least square mean, etc), and sometimes
> statistics from different statistical procedures on the same page.
> Robert Wilkins
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list