| Title: | Summarizing Graphs for Literature Reviews |
|---|---|
| Description: | Summarizes and visualizes categorical data extracted during literature reviews and evidence syntheses, starting from a data frame with one row per study. Generates publication-ready bar, stacked bar, histogram, waffle, donut, treemap, alluvial, trend, co-occurrence, 'UpSet', tree, and study-by-criteria matrix figures, together with world maps and formatted summary tables. Plot functions return standard 'ggplot2' objects that can be further customized, and an interactive 'Shiny' application is included for building figures without writing code. Aims to help researchers report study characteristics consistently across many publications. |
| Authors: | Sonsoles López-Pernas [aut, cre, cph], Kamila Misiejuk [aut], Mohammed Saqr [aut] |
| Maintainer: | Sonsoles López-Pernas <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-10-07 11:32:36 UTC |
| Source: | https://github.com/sonsoleslp/litreview |
Downloads an Excel file from a URL and reads a specified sheet.
import_from_google_drive(url, sheet)import_from_google_drive(url, sheet)
url |
Character. The download URL for the Excel file. |
sheet |
Character or integer. The sheet name or index to read. |
A data frame with the contents of the specified sheet.
## Not run: df <- import_from_google_drive( "https://drive.google.com/uc?export=download&id=FILE_ID", sheet = 1 ) ## End(Not run)## Not run: df <- import_from_google_drive( "https://drive.google.com/uc?export=download&id=FILE_ID", sheet = 1 ) ## End(Not run)
A character vector of 8 hex colors for use in literature review plots.
PALETTEPALETTE
An object of class character of length 8.
Anywhere a colors (or palette-style fill) argument accepts this
vector, you may instead pass the name of an RColorBrewer palette
(e.g. "Set2", "Dark2", "Blues"); it is expanded to the number of
categories needed. For the heatmap and map fills, a sequential/diverging
ColorBrewer name (e.g. "Blues", "RdYlBu") switches to
ggplot2::scale_fill_distiller(). Using a ColorBrewer name requires the
RColorBrewer package.
PALETTE # A ColorBrewer palette name works wherever `colors` is accepted: if (requireNamespace("RColorBrewer", quietly = TRUE)) { reviewWaffle(studies, Design, colors = "Set2") }PALETTE # A ColorBrewer palette name works wherever `colors` is accepted: if (requireNamespace("RColorBrewer", quietly = TRUE)) { reviewWaffle(studies, Design, colors = "Set2") }
Shows co-occurrence and flow between categories across multiple columns. Each study traces a path through the strata. Requires the ggalluvial package.
reviewAlluvial( data, cols, sep = "\r\n", study_id = StudyID, colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", labels = c("none", "prop", "count", "both"), flow_labels = FALSE, flow_alpha = 0.25, stratum_width = 0.5, axis_labels = NULL )reviewAlluvial( data, cols, sep = "\r\n", study_id = StudyID, colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", labels = c("none", "prop", "count", "both"), flow_labels = FALSE, flow_alpha = 0.25, stratum_width = 0.5, axis_labels = NULL )
data |
A data frame. |
cols |
Character vector of column names to use as axes (left to right). |
sep |
Character. Separator for multi-value cells. Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
colors |
Character vector. Fill colors for strata, cycled or matched by name. Defaults to PALETTE. |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop rows with missing values? Defaults to |
na_label |
Character. Label for missing values when |
labels |
Character. What to show on each stratum. One of |
flow_labels |
Logical. If |
flow_alpha |
Numeric. Transparency of flows (0–1). Defaults to |
stratum_width |
Numeric. Width of stratum bars. Defaults to |
axis_labels |
Character vector of custom axis labels (same length as
|
A ggplot2::ggplot object.
df <- data.frame( StudyID = paste0("S", 1:6), Design = c("RCT", "Cohort", "RCT", "RCT", "Cohort", "RCT"), Quality = c("High", "Low", "High", "Low", "Low", "High"), Outcome = c("Positive", "Negative", "Positive", "Negative", "Positive", "Positive"), stringsAsFactors = FALSE ) if (requireNamespace("ggalluvial", quietly = TRUE)) { reviewAlluvial(df, c("Design", "Quality", "Outcome")) }df <- data.frame( StudyID = paste0("S", 1:6), Design = c("RCT", "Cohort", "RCT", "RCT", "Cohort", "RCT"), Quality = c("High", "Low", "High", "Low", "Low", "High"), Outcome = c("Positive", "Negative", "Positive", "Negative", "Positive", "Positive"), stringsAsFactors = FALSE ) if (requireNamespace("ggalluvial", quietly = TRUE)) { reviewAlluvial(df, c("Design", "Quality", "Outcome")) }
Summarizes a column from literature review data and produces a horizontal
bar chart with frequency and percentage labels. Returns a standard
ggplot2::ggplot object that can be customized with +.
reviewBar( data, col, fill = "#7BB0D1", width = 0.6, sep = "\r\n", studlabs = FALSE, study_id = StudyID, label_space = 1.6, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )reviewBar( data, col, fill = "#7BB0D1", width = 0.6, sep = "\r\n", studlabs = FALSE, study_id = StudyID, label_space = 1.6, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )
data |
A data frame with at least a study ID column and the column
named by |
col |
Column to visualize (quoted or unquoted). |
fill |
Character. Bar fill color. Defaults to |
width |
Numeric. Bar width (0–1). Defaults to |
sep |
Character. Separator for multi-value cells. Defaults to |
studlabs |
Logical. If |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
label_space |
Numeric. Multiplier for x-axis headroom to fit labels.
Defaults to |
base_size |
Numeric. Base font size in points; controls proportional
scaling of all text and elements. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_in_percent |
Logical. Include missing rows in the percentage
denominator? Defaults to |
na_last |
Logical. If |
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewBar(df, Design) reviewBar(df, Design, fill = "#59a14f") + ggplot2::labs(title = "Designs")df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewBar(df, Design) reviewBar(df, Design, fill = "#59a14f") + ggplot2::labs(title = "Designs")
Bins the values of a numeric column and plots the frequency of each bin.
Optionally stacks bars by a second categorical column. Returns a
ggplot2::ggplot object that can be customized with +.
reviewHistogram( data, col, fill_by = NULL, bins = 30, binwidth = NULL, fill = "#7BB0D1", colors = PALETTE, sep = "\r\n", base_size = 12, na.rm = TRUE, na_label = "Not reported" )reviewHistogram( data, col, fill_by = NULL, bins = 30, binwidth = NULL, fill = "#7BB0D1", colors = PALETTE, sep = "\r\n", base_size = 12, na.rm = TRUE, na_label = "Not reported" )
data |
A data frame containing at least the column named by |
col |
Numeric column to bin (quoted or unquoted). |
fill_by |
Optional categorical column to stack the bars by (quoted or
unquoted). If |
bins |
Integer. Number of bins. Passed to
|
binwidth |
Numeric. Optional bin width. Overrides |
fill |
Character. Bar fill color when |
colors |
Character vector. Fill colors cycled across categories when
|
sep |
Character. Separator for multi-value cells in |
base_size |
Numeric. Base font size in points; controls proportional
scaling of all text and elements. Defaults to |
na.rm |
Logical. Drop rows with missing values in |
na_label |
Character. Label for missing values in |
A ggplot2::ggplot object.
df <- data.frame( StudyID = paste0("S", 1:20), SampleSize = c(30, 45, 60, 22, 88, 120, 35, 51, 74, 66, 40, 95, 110, 28, 72, 58, 41, 33, 80, 105), Design = rep(c("RCT", "Cohort", "Case-control", "Other"), 5) ) reviewHistogram(df, SampleSize, bins = 8) reviewHistogram(df, SampleSize, fill_by = Design, bins = 8)df <- data.frame( StudyID = paste0("S", 1:20), SampleSize = c(30, 45, 60, 22, 88, 120, 35, 51, 74, 66, 40, 95, 110, 28, 72, 58, 41, 33, 80, 105), Design = rep(c("RCT", "Cohort", "Case-control", "Other"), 5) ) reviewHistogram(df, SampleSize, bins = 8) reviewHistogram(df, SampleSize, fill_by = Design, bins = 8)
Counts the number of studies per country and shades a world map accordingly.
Country values may be English names, common aliases (e.g. "United States",
"United Kingdom"), or ISO 2- or 3-letter codes (e.g. "US"/"USA",
"GB"/"GBR"), all resolved automatically. Any value that cannot be matched
to a map region triggers a warning listing it, so it is easy to correct.
Returns a ggplot2::ggplot object.
reviewMap( data, country_col = Country, sep = "\r\n", fill = "#7BB0D1", base_size = 12, na.rm = TRUE )reviewMap( data, country_col = Country, sep = "\r\n", fill = "#7BB0D1", base_size = 12, na.rm = TRUE )
data |
A data frame with at least the column named by |
country_col |
Country column (quoted or unquoted). Defaults to
|
sep |
Character. Separator for multi-value cells. Defaults to |
fill |
Character. High-end color for the gradient. Defaults to
|
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
Unlike the categorical plots, reviewMap() takes only na.rm: a
choropleth has no missing-value category to label (na_label) and shows a
colour scale rather than a percentage (na_in_percent), so those arguments
do not apply. Countries with no data are shaded with a neutral na.value.
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3"), Country = c("Spain", "Spain", "Germany"), stringsAsFactors = FALSE ) if (requireNamespace("maps", quietly = TRUE)) { reviewMap(df) }df <- data.frame( StudyID = c("S1", "S2", "S3"), Country = c("Spain", "Spain", "Germany"), stringsAsFactors = FALSE ) if (requireNamespace("maps", quietly = TRUE)) { reviewMap(df) }
Draws an evidence / coding matrix: one row per study, one column per
criterion, and a tile wherever a study addresses a criterion. The tile
fill encodes an optional per-study attribute (e.g. document type) and the
letter inside each tile is the cell's own value (e.g. a coding level such
as O/D/M). Column headers can carry the number of studies addressing
each criterion. Returns a standard ggplot2::ggplot object.
reviewMatrix( data, cols, color_by = NULL, study_id = StudyID, levels = NULL, colors = PALETTE, show_counts = TRUE, base_size = 12, label_wrap = 20, empty_fill = "#FCFCE6", tile_color = "white", na.rm = TRUE, na_label = "Not reported" )reviewMatrix( data, cols, color_by = NULL, study_id = StudyID, levels = NULL, colors = PALETTE, show_counts = TRUE, base_size = 12, label_wrap = 20, empty_fill = "#FCFCE6", tile_color = "white", na.rm = TRUE, na_label = "Not reported" )
data |
A data frame with one row per study. |
cols |
Character vector of criterion column names, in the order they
should appear on the x-axis. Each cell holds the code shown in the tile,
or |
color_by |
Optional column name (character) giving each study's category,
mapped to the tile fill (e.g. |
study_id |
Column with the study labels for the y-axis (quoted or
unquoted). Defaults to |
levels |
Optional named character vector mapping cell codes to
descriptions for the "Level" legend, e.g.
|
colors |
Character vector of fill colors for the |
show_counts |
Logical. Append |
base_size |
Numeric. Base font size in points. Defaults to |
label_wrap |
Integer. Wrap axis labels longer than this many characters.
|
empty_fill |
Character. Fill for the background grid behind empty cells.
Defaults to |
tile_color |
Character. Border color between tiles. Defaults to
|
na.rm |
Logical. If |
na_label |
Character. Code shown in unaddressed cells when
|
The input is one row per study (wide format): a study-id column, an optional
grouping column for the fill, and one column per criterion holding the cell
code (or NA/empty where the study does not address that criterion).
A ggplot2::ggplot object.
studies_wide <- data.frame( StudyID = c("Tam 2024", "Schiff 2021", "Reddy 2023", "Yu 2023"), Type = c("Journal", "Journal", "Journal", "Conference"), Accuracy = c("O", "D", "D", "M"), Equity = c(NA, "D", "D", "O"), Ethics = c("O", "D", "D", "O"), stringsAsFactors = FALSE ) reviewMatrix(studies_wide, c("Accuracy", "Equity", "Ethics"), color_by = "Type", levels = c(O = "Operationalized", D = "Discussed", M = "Mention"))studies_wide <- data.frame( StudyID = c("Tam 2024", "Schiff 2021", "Reddy 2023", "Yu 2023"), Type = c("Journal", "Journal", "Journal", "Conference"), Accuracy = c("O", "D", "D", "M"), Equity = c(NA, "D", "D", "O"), Ethics = c("O", "D", "D", "O"), stringsAsFactors = FALSE ) reviewMatrix(studies_wide, c("Accuracy", "Equity", "Ethics"), color_by = "Type", levels = c(O = "Operationalized", D = "Discussed", M = "Mention"))
Counts how many studies share each combination of values in two columns and displays the result as a tile heatmap. Returns a ggplot2::ggplot object.
reviewOverlap( data, col1, col2, sep = "\r\n", fill = "#7BB0D1", base_size = 12, na.rm = TRUE, na_label = "Not reported", studlabs = FALSE, study_id = StudyID, label_wrap = 15 )reviewOverlap( data, col1, col2, sep = "\r\n", fill = "#7BB0D1", base_size = 12, na.rm = TRUE, na_label = "Not reported", studlabs = FALSE, study_id = StudyID, label_wrap = 15 )
data |
A data frame with at least the columns named by |
col1 |
First column (quoted or unquoted), mapped to the x-axis. |
col2 |
Second column (quoted or unquoted), mapped to the y-axis. |
sep |
Character. Separator for multi-value cells. Defaults to |
fill |
Character. High-end color for the gradient. Defaults to
|
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
studlabs |
Logical. If |
study_id |
Column containing study identifiers (quoted or unquoted).
Used when |
label_wrap |
Integer. Wrap axis tick labels longer than this many
characters onto multiple lines. Set to |
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), Country = c("UK", "UK", "Spain", "Spain"), stringsAsFactors = FALSE ) reviewOverlap(df, Design, Country) reviewOverlap(df, Design, Country, studlabs = TRUE)df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), Country = c("UK", "UK", "Spain", "Spain"), stringsAsFactors = FALSE ) reviewOverlap(df, Design, Country) reviewOverlap(df, Design, Country, studlabs = TRUE)
Summarizes a column and displays frequencies as a donut (default) or pie chart with count and percentage labels. Returns a ggplot2::ggplot object.
reviewPie( data, col, sep = "\r\n", colors = PALETTE, donut = TRUE, study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )reviewPie( data, col, sep = "\r\n", colors = PALETTE, donut = TRUE, study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )
data |
A data frame with at least a study ID column and the column
named by |
col |
Column to visualize (quoted or unquoted). |
sep |
Character. Separator for multi-value cells. Defaults to |
colors |
Character vector. Fill colors cycled across categories. Defaults to PALETTE. |
donut |
Logical. If |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_in_percent |
Logical. Include missing rows in the percentage
denominator? Defaults to |
na_last |
Logical. If |
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewPie(df, Design) reviewPie(df, Design, donut = FALSE)df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewPie(df, Design) reviewPie(df, Design, donut = FALSE)
Cross-tabulates a primary category (col) against a grouping variable
(group) and displays the result as horizontal stacked bars. Use
position = "fill" for within-category proportions (each bar sums to
100%) or position = "stack" for raw counts. Both columns may contain
multi-value cells, which are split before counting. Returns a standard
ggplot2::ggplot object.
reviewStackedBar( data, col, group, position = c("fill", "stack"), fill = PALETTE, width = 0.7, sep = "\r\n", study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_last = FALSE, labels = TRUE )reviewStackedBar( data, col, group, position = c("fill", "stack"), fill = PALETTE, width = 0.7, sep = "\r\n", study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_last = FALSE, labels = TRUE )
data |
A data frame with at least the columns named by |
col |
Primary category (quoted or unquoted); one horizontal bar per value. |
group |
Grouping/splitting column (quoted or unquoted); mapped to the bar fill. |
position |
Character. |
fill |
Character vector of fill colors for the groups. Defaults to PALETTE. |
width |
Numeric. Bar width (0–1). Defaults to |
sep |
Character. Separator for multi-value cells. Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_last |
Logical. If |
labels |
Logical. Draw the count (or percentage) inside each segment?
Defaults to |
A ggplot2::ggplot object.
df <- data.frame( StudyID = paste0("S", 1:6), Design = c("RCT", "Cohort", "RCT", "Cohort", "RCT", "Cohort"), Risk = c("Low", "High", "Low", "Moderate", "High", "Low"), stringsAsFactors = FALSE ) reviewStackedBar(df, Design, Risk) reviewStackedBar(df, Design, Risk, position = "stack")df <- data.frame( StudyID = paste0("S", 1:6), Design = c("RCT", "Cohort", "RCT", "Cohort", "RCT", "Cohort"), Risk = c("Low", "High", "Low", "Moderate", "High", "Low"), stringsAsFactors = FALSE ) reviewStackedBar(df, Design, Risk) reviewStackedBar(df, Design, Risk, position = "stack")
Summarizes a column from literature review data and returns a formatted
gt::gt() table showing each category, its associated study IDs,
frequency, and percentage.
reviewTable( data, col, sep = "\r\n", study_id = StudyID, latex = FALSE, cite = FALSE, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )reviewTable( data, col, sep = "\r\n", study_id = StudyID, latex = FALSE, cite = FALSE, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )
data |
A data frame with at least a study ID column and the column
named by |
col |
Column to summarize (quoted or unquoted). |
sep |
Character. Separator for multi-value cells. Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
latex |
Logical. If |
cite |
Logical. If |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_in_percent |
Logical. Include missing rows in the percentage
denominator? Defaults to |
na_last |
Logical. If |
A gt::gt() table, or a LaTeX character string if latex = TRUE.
The LaTeX output prints cleanly in the console, and renders automatically
in knitr/R Markdown chunks with results = "asis".
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewTable(df, Design) reviewTable(df, Design, latex = TRUE, cite = TRUE)df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewTable(df, Design) reviewTable(df, Design, latex = TRUE, cite = TRUE)
Draws a left-to-right node-link tree from a set of columns given in order. The first column forms the top-level branches, the next column their children, and so on; multi-value cells are split so a study can sit in several branches. Each level-1 branch gets its own colour, inherited by its descendants, and the leaves can attach a wrapped list of the studies that reach them. Returns a standard ggplot2::ggplot object.
reviewTree( data, cols, study_id = StudyID, sep = "\r\n", show_members = TRUE, member_wrap = 36, label_wrap = 18, counts = c("none", "count", "percent", "both"), root_label = "All studies", colors = PALETTE, root_fill = "#F4F4C8", base_size = 11, na.rm = TRUE, na_label = "Not reported", na_last = FALSE )reviewTree( data, cols, study_id = StudyID, sep = "\r\n", show_members = TRUE, member_wrap = 36, label_wrap = 18, counts = c("none", "count", "percent", "both"), root_label = "All studies", colors = PALETTE, root_fill = "#F4F4C8", base_size = 11, na.rm = TRUE, na_label = "Not reported", na_last = FALSE )
data |
A data frame with one row per study. |
cols |
Character vector of columns defining the hierarchy, from root (first) to leaf (last). Each level branches by that column's values. |
study_id |
Column with the study labels collected at the leaves (quoted
or unquoted). Defaults to |
sep |
Character. Separator for multi-value cells. Defaults to |
show_members |
Logical. Attach a box listing the contributing studies at
each leaf. Defaults to |
member_wrap |
Integer. Wrap the member list at this many characters.
Defaults to |
label_wrap |
Integer. Wrap node labels at this many characters.
Defaults to |
counts |
Character. Annotate each node with the number and/or percentage
of studies it covers: |
root_label |
Character. Text for the root node. Defaults to
|
colors |
Character vector of branch colours (one per level-1 value). Defaults to PALETTE. |
root_fill |
Character. Fill for the root node. Defaults to |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_last |
Logical. If |
A ggplot2::ggplot object.
data(studies) reviewTree(studies, c("InterventionType", "Intervention"), study_id = Author)data(studies) reviewTree(studies, c("InterventionType", "Intervention"), study_id = Author)
Displays category frequencies as nested rectangles whose area is proportional to the count. Optionally color by a second column for a hierarchical view. Requires the treemapify package.
reviewTreemap( data, col, color_by = NULL, sep = "\r\n", colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", study_id = StudyID, studlabs = FALSE, border_col = "white" )reviewTreemap( data, col, color_by = NULL, sep = "\r\n", colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", study_id = StudyID, studlabs = FALSE, border_col = "white" )
data |
A data frame. |
col |
Column whose values define the rectangles (quoted or unquoted). |
color_by |
Optional second column (quoted or unquoted) used to fill
the rectangles. When supplied the treemap is grouped hierarchically by
|
sep |
Character. Separator for multi-value cells. Defaults to |
colors |
Character vector. Fill colors, cycled or matched by name. Defaults to PALETTE. |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
studlabs |
Logical. If |
border_col |
Character. Color of rectangle borders. Defaults to
|
A ggplot2::ggplot object.
df <- data.frame( StudyID = paste0("S", 1:8), Design = c("RCT", "Cohort", "RCT", "RCT", "Cohort", "RCT", "Cohort", "RCT"), Quality = c("High", "Low", "High", "Low", "Low", "High", "Low", "High"), stringsAsFactors = FALSE ) if (requireNamespace("treemapify", quietly = TRUE)) { reviewTreemap(df, Design) reviewTreemap(df, Design, color_by = Quality) }df <- data.frame( StudyID = paste0("S", 1:8), Design = c("RCT", "Cohort", "RCT", "RCT", "Cohort", "RCT", "Cohort", "RCT"), Quality = c("High", "Low", "High", "Low", "Low", "High", "Low", "High"), stringsAsFactors = FALSE ) if (requireNamespace("treemapify", quietly = TRUE)) { reviewTreemap(df, Design) reviewTreemap(df, Design, color_by = Quality) }
Shows how the values in a column distribute across publication years as a stacked bar chart. Returns a ggplot2::ggplot object.
reviewTrend( data, col, year_col = Year, sep = "\r\n", colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_last = FALSE, labels = c("none", "count", "percent", "both", "studies"), study_id = StudyID )reviewTrend( data, col, year_col = Year, sep = "\r\n", colors = PALETTE, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_last = FALSE, labels = c("none", "count", "percent", "both", "studies"), study_id = StudyID )
data |
A data frame with at least |
col |
Column to visualize (quoted or unquoted). |
year_col |
Year column (quoted or unquoted). Defaults to |
sep |
Character. Separator for multi-value cells. Defaults to |
colors |
Character vector. Fill colors cycled across categories. Defaults to PALETTE. |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_last |
Logical. If |
labels |
Character. What to display on each bar segment. One of
|
study_id |
Column containing study identifiers (quoted or unquoted).
Used when |
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Year = c(2020, 2021, 2021, 2022), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewTrend(df, Design) reviewTrend(df, Design, labels = "count") reviewTrend(df, Design, labels = "percent") reviewTrend(df, Design, labels = "studies")df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Year = c(2020, 2021, 2021, 2022), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewTrend(df, Design) reviewTrend(df, Design, labels = "count") reviewTrend(df, Design, labels = "percent") reviewTrend(df, Design, labels = "studies")
Visualizes how the values of a multi-value column co-occur across studies.
Each study contributes the set of distinct values it reports; the plot
shows the size of each observed combination (intersection) as a bar, with a
dot matrix beneath indicating which values make up that combination. This
scales past the pairwise reviewOverlap() when three or more values can
co-occur. Returns a standard ggplot2::ggplot object.
reviewUpset( data, col, sep = "\r\n", study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", n_intersections = 15, sort_by = c("freq", "degree"), fill = "#7BB0D1" )reviewUpset( data, col, sep = "\r\n", study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", n_intersections = 15, sort_by = c("freq", "degree"), fill = "#7BB0D1" )
data |
A data frame with at least the columns named by |
col |
Multi-value column to analyze (quoted or unquoted). |
sep |
Character. Separator for multi-value cells. Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
One combination is formed per study. Defaults to |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
n_intersections |
Integer. Maximum number of combinations (bars) to
display, keeping the largest. Defaults to |
sort_by |
Character. Order bars by |
fill |
Character. Bar and matrix-dot color. Defaults to |
Requires the ggupset package.
A ggplot2::ggplot object.
df <- data.frame( StudyID = paste0("S", 1:5), Outcome = c("Pain", "Pain\nFunction", "Function", "Pain\nFunction\nQoL", "QoL"), stringsAsFactors = FALSE ) if (requireNamespace("ggupset", quietly = TRUE)) { reviewUpset(df, Outcome, sep = "\n") }df <- data.frame( StudyID = paste0("S", 1:5), Outcome = c("Pain", "Pain\nFunction", "Function", "Pain\nFunction\nQoL", "QoL"), stringsAsFactors = FALSE ) if (requireNamespace("ggupset", quietly = TRUE)) { reviewUpset(df, Outcome, sep = "\n") }
Summarizes a column and displays frequencies as a grid of colored squares. Each square represents one occurrence. Returns a ggplot2::ggplot object.
reviewWaffle( data, col, sep = "\r\n", colors = PALETTE, ncol = 5, study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )reviewWaffle( data, col, sep = "\r\n", colors = PALETTE, ncol = 5, study_id = StudyID, base_size = 12, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )
data |
A data frame with at least a study ID column and the column
named by |
col |
Column to visualize (quoted or unquoted). |
sep |
Character. Separator for multi-value cells. Defaults to |
colors |
Character vector. Fill colors cycled across categories. Defaults to PALETTE. |
ncol |
Integer. Number of columns in the grid. Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
base_size |
Numeric. Base font size in points. Defaults to |
na.rm |
Logical. Drop missing values? Defaults to |
na_label |
Character. Label for missing values when |
na_in_percent |
Logical. Include missing rows in the percentage
denominator? Defaults to |
na_last |
Logical. If |
A ggplot2::ggplot object.
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewWaffle(df, Design)df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", "RCT", "Case-control"), stringsAsFactors = FALSE ) reviewWaffle(df, Design)
Opens an interactive Shiny application for uploading literature review data and creating summary plots. The app provides a notebook-style interface where plots are added as cards that can be individually downloaded or exported together as a ZIP file.
run_app(...)run_app(...)
... |
Arguments passed to |
Called for its side-effect (launches the app). Returns the value
of shiny::runApp() invisibly.
if (interactive()) { run_app() }if (interactive()) { run_app() }
A synthetic dataset of 50 fictional studies for demonstrating the
plotting functions in litReview. Contains 27 columns covering
common fields extracted during a literature review, including a block of
methodological reporting criteria suitable for reviewMatrix().
studiesstudies
A data frame with 50 rows and 27 variables:
Unique study identifier (S01–S50).
BibTeX citation key.
Author list (e.g. "Garcia et al.").
Publication year (2018–2024).
Full reference string.
Country or countries where the study was conducted. Multi-value cells are separated by newlines.
Study design (e.g. RCT, Cohort, Cross-sectional).
Number of participants.
Follow-up duration in weeks, or NA.
Target age group. May contain multiple values.
Study setting (e.g. Hospital, Community, Online).
Intervention type (e.g. CBT, Exercise). May contain multiple values.
Reported outcome (e.g. Pain, Function). May contain multiple values.
Statistical or analytical approach used.
Risk of bias rating (Low, Moderate, High, or NA).
Funding source, or NA.
Whether the study is open access (Yes, No, or NA).
Higher-order grouping of Intervention
(Behavioral, Educational, Physical, Medical, Multimodal).
Publication type (Journal, Conference, Preprint, Report).
Reporting of randomization. Coded "F" (full),
"P" (partial), "M" (mentioned), or NA (not
addressed). Trial-only item: NA for non-RCT designs.
Reporting of blinding, coded as Randomization.
Trial-only item: NA for non-RCT designs.
Reporting of sample-size justification, coded
"F"/"P"/"M"/NA.
Reporting of attrition/dropout, coded as above.
Reporting of ethics approval, coded as above.
Reporting of preregistration, coded as above.
Reporting of effect sizes, coded as above.
Reporting of study limitations, coded as above.
The reporting-criteria columns (Randomization through
LimitationsDiscussed) are coded for how fully each study reports the
item — "F" full, "P" partial, "M" only mentioned, or
NA not addressed — and are designed for the study-by-criteria
reviewMatrix() plot.
data(studies) reviewBar(studies, Design) # Reporting-criteria matrix criteria <- c("Randomization", "Blinding", "SampleJustification", "AttritionReported", "EthicsApproval", "Preregistration", "EffectSize", "LimitationsDiscussed") reviewMatrix(studies, criteria, color_by = "PubType", levels = c(F = "Full", P = "Partial", M = "Mention"))data(studies) reviewBar(studies, Design) # Reporting-criteria matrix criteria <- c("Randomization", "Blinding", "SampleJustification", "AttritionReported", "EthicsApproval", "Preregistration", "EffectSize", "LimitationsDiscussed") reviewMatrix(studies, criteria, color_by = "PubType", levels = c(F = "Full", P = "Partial", M = "Mention"))
Splits multi-value cells, counts frequencies, and computes percentages.
summarize_data( data, col, sep = "\r\n", study_id = StudyID, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )summarize_data( data, col, sep = "\r\n", study_id = StudyID, na.rm = TRUE, na_label = "Not reported", na_in_percent = TRUE, na_last = FALSE )
data |
A data frame containing at least the columns specified by
|
col |
Column to summarize (quoted or unquoted). |
sep |
Character. The separator used to split multi-value cells.
Defaults to |
study_id |
Column containing study identifiers (quoted or unquoted).
Defaults to |
na.rm |
Logical. If |
na_label |
Character. Label used for missing values when
|
na_in_percent |
Logical. If |
na_last |
Logical. If |
A data frame with columns for the grouping variable, Studies
(comma-separated study IDs), Frequency, and Percent (numeric, 0–100).
df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", NA, "RCT"), stringsAsFactors = FALSE ) # Drop NAs (default) summarize_data(df, Design) # Keep NAs with a custom label summarize_data(df, Design, na.rm = FALSE, na_label = "Missing") # Percentages of non-missing only summarize_data(df, Design, na_in_percent = FALSE)df <- data.frame( StudyID = c("S1", "S2", "S3", "S4"), Design = c("RCT", "Cohort", NA, "RCT"), stringsAsFactors = FALSE ) # Drop NAs (default) summarize_data(df, Design) # Keep NAs with a custom label summarize_data(df, Design, na.rm = FALSE, na_label = "Missing") # Percentages of non-missing only summarize_data(df, Design, na_in_percent = FALSE)
A clean, manuscript-ready ggplot2 theme with white background, bold axis
titles, and bottom legend. All litReview plot functions use this theme
by default. The single base_size parameter controls the proportional
scaling of all text and spacing — increase for posters/slides, decrease
for multi-panel figures.
theme_litreview(base_size = 12)theme_litreview(base_size = 12)
base_size |
Numeric. Base font size in points. Defaults to |
A ggplot2::theme object.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_litreview() # Larger for presentations ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_litreview(base_size = 18)library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_litreview() # Larger for presentations ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_litreview(base_size = 18)