Here is an example of a forest plot containing combined results of risk ratios for a comparison of three exposure groups (high dose, low dose, control, say) from a hypothetical study. These data are in long format, there is also a version in wide format. Some familiarity with the forestploter package is assumed. The reader might want to look at the simple forest plot before continuing.
Data
This version of the data is in long format, meaning each exposure group contributes with a row/observation for each subgroup that has been analyzed.
library(forestploter)library(grid)library(data.table)library(dplyr)results <-fread("./data/TwoComparisonFPdataLong.csv")# overview of selected variables - first 10 observationsprint(results[1:10,c(1:4,6:8)], digits =5)
level x n events rr lcl ucl
<char> <int> <int> <int> <num> <num> <num>
1: Overall NA NA NA NA NA NA
2: 0 20400 1634 NA NA NA
3: 1 22150 1198 0.67524 0.62828 0.72571
4: 2 6063 484 0.99663 0.90424 1.09847
5: Sex Female NA NA NA NA NA NA
6: 0 9243 681 NA NA NA
7: 1 10143 472 0.63160 0.56358 0.70783
8: 2 2811 196 0.94637 0.81198 1.10301
9: Sex Male NA NA NA NA NA NA
10: 0 11157 953 NA NA NA
The data needs a bit of editing before it is ready to be plugged into forest.
The data are ready to be plotted. In the theme we specify 4 colors for stripe-alternation; dark for subgroup header, white-light-white for specific exposure groups.