Closed zaddyzad closed 3 years ago
Thank you for the suggestion! I added an example below. Don't mind the column names for the domains, but you can see doverall_applicability (doverall_a) doesn't make it into the summary plot and, and that rob_traffic_light plot gives an error.
library(tibble)
library(robvis)
#> Warning: package 'robvis' was built under R version 4.0.5
library(reprex)
data <- tibble::tribble(
~ stud , ~ d1, ~ d2, ~ d3, ~ d4, ~ d1a, ~ d2a, ~ d3a, ~ doverall, ~ doverall_a, ~ weight,
"study1", "high", "high", "low", "low", "low", "high", "high", "high", "high", 1,
"study2", "low", "high", "low", "low", "low", "high", "low", "high", "low", 1,
"study2", "high", "high", "low", "low", "low", "high", "low", "high", "low", 1,
)
data <- as.data.frame(data)
rob_summary(data,tool='ROB1')
rob_traffic_light(data=data, tool='ROB1')
#> Error: Aesthetics must be either length 1 or the same as the data (1): colour
Created on 2021-06-08 by the reprex package (v0.3.0)
Can you please provide a minimal reproducible example using the reprex package? The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you've never made a minimal reprex before, there is lots of good advice here.
I'm new to GitHub, so my apologies if I was supposed to quote reply the reprex to your comment.
Hi @zaddyzad - no, that's perfect, thanks!
Not entirely sure what is going on here, but will look into it and get back to you shortly.
Hi @zaddyzad,
I think I have worked out what is going on - you have the old CRAN version of the package installed which does not provide good handling of the "ROB1/Generic" template. In order to create your figures, please install the newest development version of the package using:
install.packages("devtools")
devtools::install_github("mcguinlu/robvis")
Once you have done that, running
robvis::rob_summary(data,tool='Generic', overall = F)
using the data you provided will produced the barplot you are after (see below). In this case, the overall = F
argument just prevents the last domain heading from being bolded.
For the traffic light plot, things are a little bit more complicated. Installing the development version of the package will allow you to create the following plot using your example data:
However, because I thought there would only ever b1 one "overall" column per plot, this doesn't look exactly right, as one overall column title is put into the caption with the other domains, and the other is left in the column heading. This is something I need to work on further in the package. As a stop-gap, my best recommendation is to produce two traffic light plots, one for risk of bias and one for applicability, and merge them using patchwork:
library(patchwork)
p1 <-
robvis::rob_traffic_light(data[c(1:5, 9)], tool = "Generic", x_title = "Risk of bias domains")
p2 <-
robvis::rob_traffic_light(data[c(1, 6:8, 10)], tool = "Generic", x_title = "Applicability domains")
p <- p1 + p2 + plot_layout(guides = 'collect', tag_level = "new") + plot_annotation(tag_levels = c("A", "B")) &
theme(legend.position = 'bottom',
legend.justification = "right")
Yo can then reference to "Figure X, Panel A" in the text. This is actually how I believe the results for tools with both risk of bias and applicability sections should be displayed, as I think it makes it a lot easier to interpret.
Hopefully this helps!
@mcguinlu Thank you so much for all this, it all works splendidly!
PROBAST support would be a wonderful addition for subsequent versions of the tool.
Thank you for also introducing me to the patchwork package. This will be very helpful in the future.
Ideal - glad it worked out. And PROBAST is definitely on my list of tools to add.
I'll close this issue now.
I have two problems with the main functions of ROBVIS, help would be sincerely appreciated!
First problem, rob_summary:
I am using PROBAST and there 9 domains: 4 for RoB, 3 for applicability, and 2 for overall assessments. When I use rob_summary to plot the data, the plot only shows the first 8 domains.
The second problem is with rob_traffic_light:
When I try to plot the data, I get the error "Error: Aesthetics must be either length 1 or the same as the data (1): colour."
The code is here, and a picture of the plot is attached.