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

Frank Harrell f.harrell at vanderbilt.edu
Sun Feb 26 05:49:11 CET 2012

```As Ista and Rich have implied, graphics are better than tables for AEs.
Also, statistical tests are not always of value here.  For more, see
http://www.ctspedia.org/do/view/CTSpedia/StatGraphHome and p. 47-53 of
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatGraphCourse/graphscourse.pdf.
p. 51 contains a graphic produced by Svetlana Eden at Vanderbilt University
that is particularly useful for AEs by body system and preferred term.

Frank

Ista Zahn wrote
>
> Hi Robert,
>
> http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf
>
> Best,
> Ista
>
> 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
>> 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@ mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help@ mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/How-would-you-program-an-Adverse-Events-statistical-table-using-R-code-tp4419007p4421608.html
Sent from the R help mailing list archive at Nabble.com.

```