The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Standard tables and figures

library(eudract)
library(knitr)

We can easily produce some of the standard reports needed for most clinical trials, as well as producing the xml files needed to upload to EudraCT or ClinicalTrials.gov. See the other vignette

We first ensure the data is in the correct format, column names to produce a basic safety object

head(safety)
#>         pt  subjid related      soc fatal serious        group
#> 1 10000081 US6-006   FALSE 10017947     0       1      Control
#> 2 10000081 N04-006   FALSE 10017947     0       0 Experimental
#> 3 10000891 US3-002    TRUE 10007541     0       0 Experimental
#> 4 10002383 US6-012   FALSE 10007541     0       0 Experimental
#> 5 10002895 US5-001   FALSE 10047065     0       0 Experimental
#> 6 10002916 US8-006   FALSE 10042613     0       1      Control
#>                          term
#> 1              Abdominal pain
#> 2              Abdominal pain
#> 3 Acute myocardial infarction
#> 4             Angina pectoris
#> 5           Aortic dissection
#> 6    Aortic valve replacement
safety_statistics <- safety_summary(safety,exposed=c("Control"=99, "Experimental"=101))

A top level table is the $GROUP data frame with slightly improved column names

df <- safety_statistics$GROUP
names(df) <- c("Arm", "SAE count", "Non Serious AE count", "Death from AE count", "N", "All cause deaths count")
kable(df, caption = "Total Adverse Events")
Total Adverse Events
Arm SAE count Non Serious AE count Death from AE count N All cause deaths count
Control 15 15 9 99 9
Experimental 33 24 22 101 22

Next we provide an incidence table

incidence <-  incidence_table(safety_statistics, type ="serious")
kable(incidence, caption="SAE incidence")
SAE incidence
System Organ Class Preferred Term Control (N = 99) Experimental (N = 101)
Blood and lymphatic system disorders B-cell lymphoma 1% (1, 1) 0% (0, 0)
Cardiac disorders Cardiac arrest 1% (1, 1) 0% (0, 0)
Cardiac failure congestive 0% (0, 0) 1% (1, 1)
Gastrointestinal disorders Abdominal pain 1% (1, 1) 0% (0, 0)
Gastroenteritis viral 0% (0, 0) 1% (1, 1)
Gastrointestinal haemorrhage 0% (0, 0) 1% (1, 1)
Oesophageal spasm 0% (0, 0) 1% (1, 1)
Oesophagitis 0% (0, 0) 1% (1, 1)
General disorders and administration site conditions Chest pain 0% (0, 0) 1% (1, 1)
Hepatobiliary disorders Cholecystitis acute 1% (1, 1) 1% (1, 1)
Immune system disorders Pulmonary vasculitis 1% (1, 1) 0% (0, 0)
Vasculitis 1% (1, 1) 2% (2, 2)
Infections and infestations Cellulitis 0% (0, 0) 1% (1, 1)
Escherichia urinary tract infection 1% (1, 1) 0% (0, 0)
Gastroenteritis Escherichia coli 0% (0, 0) 1% (1, 1)
Influenza 0% (0, 0) 1% (1, 1)
Lower respiratory tract infection 1% (1, 1) 0% (0, 0)
Pneumonia 0% (0, 0) 3% (3, 3)
Respiratory tract infection 0% (0, 0) 2% (2, 2)
Urinary tract infection 0% (0, 0) 1% (1, 2)
Injury, poisoning and procedural complications Fall 0% (0, 0) 1% (1, 1)
Post procedural complication 0% (0, 0) 1% (1, 1)
Investigations Medical observation 0% (0, 0) 1% (1, 1)
Metabolism and nutrition disorders Hyperglycaemia 1% (1, 1) 0% (0, 0)
Hyperkalaemia 0% (0, 0) 1% (1, 1)
Neoplasms benign, malignant and unspecified (incl cysts and polyps) Bladder papilloma 0% (0, 0) 1% (1, 1)
Nervous system disorders Cerebrovascular accident 1% (1, 1) 0% (0, 0)
Sleep apnoea syndrome 1% (1, 1) 0% (0, 0)
Psychiatric disorders Conversion disorder 0% (0, 0) 1% (1, 1)
Renal and urinary disorders Proteinuria 0% (0, 0) 1% (1, 1)
Respiratory, thoracic and mediastinal disorders Laryngeal stenosis 0% (0, 0) 2% (2, 4)
Pneumomediastinum 0% (0, 0) 1% (1, 1)
Pneumonia klebsiella 0% (0, 0) 1% (1, 1)
Pneumonia staphylococcal 0% (0, 0) 1% (1, 1)
Pneumonia viral 1% (1, 1) 0% (0, 0)
Pulmonary embolism 0% (0, 0) 1% (1, 1)
Surgical and medical procedures Aortic valve replacement 1% (1, 1) 0% (0, 0)
Cholecystectomy 0% (0, 0) 1% (1, 1)
Dacryocystorhinostomy 0% (0, 0) 1% (1, 1)
Hip arthroplasty 1% (1, 1) 2% (2, 2)
Small intestinal resection 0% (0, 0) 1% (1, 1)
Vascular disorders Deep vein thrombosis 1% (1, 1) 3% (3, 3)
Pulmonary embolism 1% (1, 1) 1% (1, 1)
incidence <-  incidence_table(safety_statistics, type ="non_serious")
kable(incidence, caption="Non-serious AE incidence")
Non-serious AE incidence
System Organ Class Preferred Term Control (N = 99) Experimental (N = 101)
Blood and lymphatic system disorders Neutropenia 0% (0, 0) 1% (1, 1)
Cardiac disorders Acute coronary syndrome 1% (1, 1) 0% (0, 0)
Acute myocardial infarction 0% (0, 0) 1% (1, 1)
Angina pectoris 0% (0, 0) 1% (1, 1)
Atrial fibrillation 0% (0, 0) 1% (1, 1)
Atrioventricular block complete 0% (0, 0) 1% (1, 1)
Gastrointestinal disorders Abdominal pain 0% (0, 0) 1% (1, 1)
Duodenal ulcer 0% (0, 0) 1% (1, 1)
Intestinal perforation 1% (1, 1) 0% (0, 0)
General disorders and administration site conditions Pyrexia 1% (1, 1) 1% (1, 1)
Hepatobiliary disorders Cholecystitis 0% (0, 0) 1% (1, 1)
Immune system disorders Drug hypersensitivity 0% (0, 0) 1% (1, 1)
Hypersensitivity 0% (0, 0) 1% (1, 1)
Vasculitis 3% (3, 4) 3% (3, 3)
Infections and infestations Escherichia urinary tract infection 0% (0, 0) 1% (1, 1)
Influenza 0% (0, 0) 1% (1, 1)
Pneumonia 2% (2, 2) 3% (3, 4)
Pneumonia pseudomonal 0% (0, 0) 1% (1, 1)
Respiratory tract infection 2% (2, 2) 1% (1, 1)
Sinusitis 0% (0, 0) 1% (1, 1)
Urinary tract infection 0% (0, 0) 1% (1, 1)
Injury, poisoning and procedural complications Wound dehiscence 0% (0, 0) 1% (1, 1)
Metabolism and nutrition disorders Dehydration 0% (0, 0) 1% (1, 1)
Musculoskeletal and connective tissue disorders Osteoarthritis 0% (0, 0) 1% (1, 1)
Neoplasms benign, malignant and unspecified (incl cysts and polyps) Anal squamous cell carcinoma 0% (0, 0) 1% (1, 1)
Squamous cell carcinoma 1% (1, 1) 0% (0, 0)
Nervous system disorders Sleep apnoea syndrome 1% (1, 2) 0% (0, 0)
Renal and urinary disorders Enterovesical fistula 0% (0, 0) 1% (1, 1)
Renal impairment 1% (1, 1) 0% (0, 0)
Respiratory, thoracic and mediastinal disorders Bronchospasm 0% (0, 0) 1% (1, 1)
Dyspnoea 0% (0, 0) 1% (1, 1)
Laryngeal stenosis 1% (1, 1) 1% (1, 1)
Lower respiratory tract infection 1% (1, 1) 0% (0, 0)
Lung adenocarcinoma 1% (1, 1) 0% (0, 0)
Pneumonia 1% (1, 1) 0% (0, 0)
Pneumonia streptococcal 0% (0, 0) 1% (1, 1)
Pneumonitis 1% (1, 1) 0% (0, 0)
Respiratory failure 0% (0, 0) 1% (1, 1)
Surgical and medical procedures Colostomy closure 0% (0, 0) 1% (1, 1)
Vascular disorders Aortic dissection 0% (0, 0) 1% (1, 1)
Deep vein thrombosis 0% (0, 0) 1% (1, 1)

A table of relative risk can be given

rr <- relative_risk_table(safety_statistics, type="serious")
kable(rr, caption="SAE relative risks")
SAE relative risks
System Organ Class Preferred Term Relative Risk (C.I.)
Hepatobiliary disorders Cholecystitis acute 0.98 (0.0605, 15.9)
Immune system disorders Vasculitis 1.96 (0.175, 22)
Surgical and medical procedures Hip arthroplasty 1.96 (0.175, 22)
Vascular disorders Deep vein thrombosis 2.94 (0.301, 28.8)
Pulmonary embolism 0.98 (0.0605, 15.9)

rr <- relative_risk_table(safety_statistics, type="non_serious")
kable(rr, caption="Non-serious AE relative risks")
Non-serious AE relative risks
System Organ Class Preferred Term Relative Risk (C.I.)
General disorders and administration site conditions Pyrexia 0.98 (0.0605, 15.9)
Immune system disorders Vasculitis 0.98 (0.193, 4.97)
Infections and infestations Pneumonia 1.47 (0.24, 8.99)
Respiratory tract infection 0.49 (0.0437, 5.49)
Respiratory, thoracic and mediastinal disorders Laryngeal stenosis 0.98 (0.0605, 15.9)

Finally a set of dot-plots to show graphically and compare, using functions from patchwork to add titles

dot_plot(safety_statistics, type="serious", base=4)
SAE

SAE

dot_plot(safety_statistics, type="non_serious", base=4)
Non-Serious AE

Non-Serious AE

If you want to modify, then access the two elements $left.panel and $right.panel to modify as standard ggplot objects. The print and plot methods glue them back together within the framework of the patchwork package. Or you can dissect, edit, save, and use however you want.

fig <- dot_plot(safety_statistics, type="non_serious", base=4)
fig$left.panel <- fig$left.panel + ggplot2::labs(title="Absolute Risk")
fig

Should you wish to save to a file, then using the workflow below will work, using a graphics device such as, png, jpeg, pdf, svg. You will need to explicitly call the print(fig) function, and just fig on its own may not work.

temp <- tempfile(fileext=".png")
png(filename = temp)
print(fig)
dev.off()

Further filtering and refinements to the labels may be provided using the relative_risk and order_filter functions. See help pages for more details.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.