-
Notifications
You must be signed in to change notification settings - Fork 22
/
README.Rmd
253 lines (187 loc) · 9.33 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "90%",
fig.width= 12,
fig.height=3)
fig_count <- 1
```
# robvis <img src="man/figures/robvis_hex_box.png" align="right" width="18%" height="18%" />
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN Badge.](https://www.r-pkg.org/badges/version-ago/robvis)](https://CRAN.R-project.org/package=robvis)
[![CRAN Downloads.](https://cranlogs.r-pkg.org/badges/last-month/robvis)](https://CRAN.R-project.org/package=robvis)
<br>
[![R build status](https://github.com/mcguinlu/robvis/workflows/R-CMD-check/badge.svg)](https://github.com/mcguinlu/robvis/actions)
[![Codecov test coverage](https://codecov.io/gh/mcguinlu/robvis/branch/master/graph/badge.svg)](https://codecov.io/gh/mcguinlu/robvis?branch=master)
<br>
[![DOI](https://img.shields.io/static/v1.svg?label=Publication&message=10.1002/jrsm.1411&color=informational)](https://doi.org/10.1002/jrsm.1411)
[![metaverse Identifier](https://img.shields.io/static/v1.svg?label=Part%20of%20the&message=metaverse&color=informational)](https://www.github.com/rmetaverse/metaverse)
**UPDATE**: `robvis` now exists as a [web-app](https://mcguinlu.shinyapps.io/robvis), aimed at those who are not familiar with R or who want to explore the package's functionality before installing it locally.
## Description
```{r include = FALSE}
library(robvis)
```
The `robvis` (Risk-Of-Bias VISualization) package facilitates the rapid production of publication-quality risk-of-bias assessment figures, correctly formatted according to the assessment tool used.
The motivation for this package is more fully described in the (open access) article introducing the tool, available [here](https://doi.org/10.1002/jrsm.1411).
## Getting started
Install the development version which contains new functionality and a range of bug fixes:
```{r, eval=FALSE}
install.packages("devtools")
devtools::install_github("mcguinlu/robvis")
```
To update the package, run the `install_github("mcguinlu/robvis")` command again.
If you wish to use the older CRAN version of the package, use the following command:
```{r, eval=FALSE}
install.packages("robvis")
```
### Load data
To load your own data from a .csv file:
```{r, eval=FALSE}
mydata <- read.csv("path/to/mydata.csv", header = TRUE)
```
To help users explore `robvis`, we have included example datasets in the package, one for each of the tool templates that currently exist within the package. The `data_rob2` dataset ([view it here](https://github.com/mcguinlu/robvis/blob/master/data_raw/data_rob2.csv)), which contains example risk-of-bias assessments performed using the RoB2.0 tool for randomized controlled trials, is used to create the plots in subsequent sections.
### Create plots
The package contains two plotting functions:
#### 1. rob_summary()
Returns a ggplot object displaying a bar-chart of the risk of bias of included studies across the domains of the specified tool. [*Note: the defaults used in this function have changed from their original settings, so that a un-weighted barplot is now produced by default. See the NEWS.md file for further information.*]
```{r, eval = FALSE}
summary_rob <- rob_summary(data = data_rob2, tool = "ROB2")
summary_rob
```
``` {r, echo = FALSE}
plot <- rob_summary(data = data_rob2, tool = "ROB2")
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
#### 2. rob_traffic_light()
Returns a ggplot object displaying a ["traffic light plot"](https://handbook-5-1.cochrane.org/chapter_8/figure_8_6_c_example_of_a_risk_of_bias_summary_figure.htm), displaying the risk of bias judgment in each domain for each study.
```{r, eval=FALSE}
trafficlight_rob <- rob_traffic_light(data = data_rob2,
tool = "ROB2",
psize = 10)
trafficlight_rob
```
``` {r, echo = FALSE}
plot <- rob_traffic_light(data = data_rob2,
tool = "ROB2",
psize = 10)
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
### Other functions
#### rob_save()
Pass the `robvis` to this function, along with a destination file, to save your risk-of-bias plots using sensible defaults.
```{r, eval = FALSE}
rob_save(trafficlight_rob, "rob_fig.png")
```
#### rob_tools()
Outputs a list of the risk of bias assessment tools for which a template currently exists in rob_summary(). We expect this list to be updated in the near future to include tools such as ROBIS (tool for assessing risk of bias in systematic reviews).
```{r}
rob_tools()
```
## Advanced usage
### Change the colour scheme
The `colour` argument of both plotting functions allows users to select from two predefined colour schemes ("cochrane" or "colourblind") or to define their own palette by providing a vector of hex codes.
For example, to use the predefined "colourblind" palette:
```{r, eval=FALSE}
rob_summary(data = data_rob2,
tool = "ROB2",
colour = "colourblind")
```
``` {r, echo = FALSE}
plot <- rob_summary(data = data_rob2,
tool = "ROB2",
colour = "colourblind")
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
And to define your own colour scheme:
```{r, eval=FALSE}
rob_summary(
data = data_rob2,
tool = "ROB2",
colour = c("#f442c8",
"#bef441",
"#000000",
"#d16684")
)
```
``` {r, echo = FALSE}
plot <- rob_summary(data = data_rob2,
tool = "ROB2",
colour = c("#f442c8",
"#bef441",
"#000000",
"#d16684"))
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
### No "Overall" judgement
By default, both functions include an "Overall" risk of bias domain. To prevent this, remove the overall column from your dataset and set `overall = FALSE`.
```{r, eval=FALSE}
summary_rob <- rob_summary(data = data_rob2[1:6], tool = "ROB2", overall = FALSE)
summary_rob
```
``` {r, echo = FALSE}
plot <- rob_summary(data = data_rob2[1:6], tool = "ROB2", overall = FALSE)
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
```{r, eval=FALSE}
rob_traffic_light(data = data_rob2[1:6],
tool = "ROB2",
overall = FALSE)
```
``` {r, echo = FALSE}
plot <- rob_traffic_light(data = data_rob2[1:6],
tool = "ROB2",
overall = FALSE)
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
### Editing the plots
Finally, because the output (`summary_rob` and `trafficlight_rob` in the examples above) is a ggplot2 object, it is easy to adjust the plot to your own preferences.
For example, to add a title:
```{r, eval=FALSE}
library(ggplot2)
rob_summary(data = data_rob2, tool = "ROB2") +
ggtitle("Summary of RoB 2.0 assessments")
```
``` {r, echo = FALSE}
plot <- rob_summary(data = data_rob2, tool = "ROB2") +
ggplot2::ggtitle("Summary of RoB2.0 assessments")
file = paste0("man/figures/robplot",fig_count,".png")
rob_save(plot, file)
fig_count <- fig_count + 1
```
<div style="text-align:center"><img src=`r file` width="70%" height="70%"/></div>
## Examples of `robvis` in published papers
To date, `robvis` has been cited in more than 1500 academic articles - these can be explored [here](https://scholar.google.com/scholar?cites=12564214960529060925&as_sdt=2005&sciodt=0,5&hl=en).
## Code of conduct
Please note that the 'robvis' project is released with a
[Contributor Code of Conduct](https://github.com/mcguinlu/robvis/blob/master/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.
## License
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/mcguinlu/robvis/blob/master/LICENSE) file for details.
## Acknowledgments
* The `rob_summary()` function was based on code forwarded by a colleague. I recently discovered that this code was adapted from that presented in the wonderful "[Doing Meta-Analysis in R](https://bookdown.org/MathiasHarrer/Doing_Meta_Analysis_in_R/plotting-the-summary.html)" guide, so I would like to acknowledge the authors here.
* [Emily Kothe](https://github.com/ekothe) for help in fixing `ggplot2` coding issues.
* [Eliza Grames](https://github.com/elizagrames) for creating the `robvis` hex sticker.