knitr::opts_chunk$set( collapse = TRUE, comment = "#>", dpi = 200, warning = FALSE ) library(prismadiagramR) library(dplyr)
library(prismadiagramR) library(dplyr)
This package aids in rapidly creating a PRISMA diagram for use in meta-analysis from a simple dataframe tracking the use of publications in the analysis.
The minimal arguments needed are: 1. Pub.ID: A unique publication ID. 2. Source: A source identifier to describe where the study is from. 3. Filter: A Filter identifier to describe how the study is filtered out or left NA if used.
From a dataframe with only the three arguments stated above we can get an initial PRISMA diagram.
set.seed(25) N <- 100 studyStatus <- data.frame(Pub.ID = seq(1:N), Source = sample(letters[1:3], N, replace = TRUE), Filter = sample(letters[1:5], N, replace = TRUE)) studyStatus$Filter[studyStatus$Filter=="e"] <- NA getPrisma(studyStatus) %>% DiagrammeR::grViz(.)
It is possible to re-order the sources and filters.
studyStatus$Source <- ordered(studyStatus$Source , levels = c("c", "b", "a")) studyStatus$Filter <- ordered(studyStatus$Filter , levels = c("d", "c", "b", "a")) getPrisma(studyStatus) %>% DiagrammeR::grViz(.)
We can also obtain a custom prismaFormat dataframe to modify to change items in the PRISMA as desired. By default this dataframe has 3 arguments: 1. prismaLvl: This describes the level the node is created at. 2. nodeType: This describes the type of node it is. 3. prismaTxt: The text used in the node for the PRISMA diagram.
prismaFormat <- getPrismaFormat(studyStatus) flextable::flextable(prismaFormat)
prismaFormat$prismaTxt[1] <- "Medline" getPrisma(studyStatus = NULL, prismaFormat = prismaFormat) %>% DiagrammeR::grViz(.)
We can add the fontSize argument to the datatable to customize the fontsize in each node.
prismaFormat$fontSize <- 15 prismaFormat$fontSize[1] <- 10 getPrisma(studyStatus = NULL, prismaFormat = prismaFormat) %>% DiagrammeR::grViz(.)
It is also possible to create the PRISMA directly from prismaFormat and create nodes that do not need a filter.
prismaFormat <- data.frame( prismaLvl = c(1,2,3,3,4), nodeType = c("Source", "Node", "Node", "Filter", "End"), prismaTxt = letters[1:5] ) getPrisma(studyStatus = NULL, prismaFormat = prismaFormat) %>% DiagrammeR::grViz(.)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.