10.2 Plotting the summary
To plot the summary, we have to import our dataset first. We describe how to do this in Chapter 3.2. I simply called my dataset rob.
Let’s have a look at the structure of the data first:
str(rob)
## 'data.frame': 43 obs. of 13 variables:
## $ Sequence_Generation : chr "Low" "Low" "Low" "Low" ...
## $ Allocation_Concealment_ : chr "Low" "Low" "Low" "Low" ...
## $ Blinding.of.Participants.and.Personnel: chr "High" "High" "High" "High" ...
## $ Blinding.of.Outcome.Assessors : chr "Low" "Low" "Low" "Low" ...
## $ Incomplete.Outcome.Data : chr "Low" "Low" "Low" "Low" ...
## $ Selective_Outcome_Reporting : chr "Low" "Unclear" "Low" "Low" ...
## $ Cointerventions : chr "Unclear" "Low" "Low" "Low" ...
## $ Serious_Flaw : chr "Low" "Low" "Low" "Low" ...
## $ Intention_to_treat_Analyses : chr "Low" "Low" "Low" "Low" ...
## $ Similar_Groups : chr "Unclear" "Low" "Low" "Low" ...
## $ Compliance : chr "Low" "Unclear" "High" "High" ...
## $ Identical_Post_Timing : chr "Low" "Low" "Low" "Low" ...
## $ Author : chr "BiesheuvelLeliefeld 2017" "Bockting 2005 & 2010 & 2015" "Bockting 2018" "Bockting 2018" ...
We can see that we have the data imported in RStudio now, with ratings for every criterion in each column. Whether you named your columns differently or used less or more criteria is not important.
To plot the risk of bias summary, we have prepared a function called rob.summary for you. The rob.summary function is part of the dmetar package. If you have the package installed already, you have to load it into your library first.
library(dmetar)
If you don’t want to use the dmetar package, you can find the source code for this function here. In this case, R doesn’t know this function yet, so we have to let R learn it by copying and pasting the code in its entirety into the console in the bottom left pane of RStudio, and then hit Enter ⏎. The function then requires the tidyr and ggplot2 package to work.
The functions has the following parameters:
| Parameter | Function |
|---|---|
| data | A data.frame containing a column for each risk of bias criterion, where rows represent each individual studies. The risk of bias assessment for each criterion for each study must be coded as a character string. Up to four codes can be used, referring to low risk of bias, unclear risk of bias, high risk of bias, or missing information. The string used to specify the categories must be specified in name.high, name.unclear, name.low and/or name.missing, unless defaults for those parameters are used. |
| name.high | Character specifying how the ‘high risk of bias’ category was coded in data (e.g., name.high = ‘high’). Default is ‘High’. |
| name.unclear | Character specifying how the ‘unclear risk of bias’ category was coded in data (e.g., name.unclear = ‘unclear’). Default is ‘Unclear’. |
| name.low | Character specifying how the ‘low risk of bias’ category was coded in data (e.g., name.low = ‘low’). Default is ‘Low’. |
| studies | A vector of the same length as the number of rows in data specifying the study labels for the risk of bias ratings. Only has to be specified when table = TRUE. |
| name.missing | Character specifying how missing information was coded in data (e.g., name.missing = ‘missing’). Default is ‘Missing’. All ratings, including missing information, must be coded as strings, so using NA in data to signify missing information is not valid. |
| table | Should an additional RevMan style risk of bias table be produced? If set to TRUE, studies must be specified. FALSE by default. |
If you named the columns and Risk of Bias levels as suggested before, you only have to provide the rob.summary function with your dataset and the study labels in studies. As we want to produce both the summary plot and the RevMan Risk of Bias table, we specify table as TRUE (this is only possible if studies is specified).
rob.summary(rob, studies = rob$Author, table = TRUE)


Looks good so far. As you can see, the rob.summary also detected words separated by "_" or “.” in the column names and automatically cleaned the output from those symbols.