How to make nice publishable adverse event tables using tidyverse

This blog post is just an answer to a colleague to provide R code for the generation of Adverse Event tables. And it is also nice to have the code available when I need it in the future. Probably I will pull my hair at the horrible code, but this gives room to enhance it later. Functions First I define all functions to be used. I reuse some of the ideas in the post where I show how to make publishable tables using purrr here.

Using purrr to make nice publishable tables

Disclaimer: This is not an introduction to using purrr. For this purpose I recommend to read chapter 21 and 25 in Hadley Wickhams R for Data Science. Much of my programming time in R is spent on finding a suitable package doing the task I am looking for. But usually it does the work almost but not quite. One of the main experiences I have had with tidyverse purrr is that I have stopped looking for these packages and just programmed them exactly as I want them.

Random allocation list generator

Introduction I have made a random allocation list generator using R Shiny. It is located at https://icostatistics.shinyapps.io/randlist/). The source code is on github. Every now and then I get the request to make a random allocation list according to some specifications, usually for a randomised controlled trial (RCT). There are many R and Stata packages out there which does this, but I do this seldom enough to forget the specifications to the function calls.