Skip to content

Instantly share code, notes, and snippets.

@mcguinlu
Last active September 6, 2022 20:42
Show Gist options
  • Save mcguinlu/fe10ba77734de1925bd6eb1ccf9a7e69 to your computer and use it in GitHub Desktop.
Save mcguinlu/fe10ba77734de1925bd6eb1ccf9a7e69 to your computer and use it in GitHub Desktop.
devtools::install_github("mcguinlu/robvis")
devtools::install_github("mcguinlu/triangulate")
library(dplyr)
# View the example dataset included in the robvis package
# This is what I am guessing your data from the assessments should look like
View(robvis::data_bias_direction)
# Notes on column names:
# d*j = judgement for domain *
# d*t = type for domain *. Can be 'Add' (additive) or 'Prop' (proportional)
# d*d = direction of bias. In the raw dataset, this is one of "Towards null", Away from null, Favours comparator, Favours intervention, Unpredictable
# Note that when the judgement fora given domain in a given study is low, the type and direction of bias for that domain are set to None
# Use {triangulate} helper functions to convert from relative to absolute
# directions of bias
dat <- robvis::data_bias_direction %>%
triangulate::tri_to_long() %>%
triangulate::tri_absolute_direction() %>%
triangulate::tri_to_wide()
# Alternatively, use the helper function to run all three tri_* functions above
# in a single line
dat <- robvis::data_bias_direction %>%
triangulate::tri_absolute_direction_quick()
# Create bias direction plot (not you need to set either vi or sei)
dat %>%
robvis:::rob_direction(vi = dat$vi)
# The plotting function should also be able to deal with fewer study types, e.g.
dat %>%
dplyr::filter(type %in% c("NRSE","NRSI")) %>%
robvis:::rob_direction(vi = .$vi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment