Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions R/prisma.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Generate a PRISMA statement flow chart
#'
#' Generate PRISMA statement flow chart for use in retrospective medical
#' research. Almost all arguments are mandatory, as they are in the recommended
#' Generate PRISMA statement flow chart for use in literature
#' research and reviews. Almost all arguments are mandatory, as they are in the recommended
#' PRISMA statement.
#' @param found Records found through database searching
#' @param found_other Additional records identified through other sources
Expand Down Expand Up @@ -145,6 +145,8 @@ prisma_graph <- function(found,
if (full_text - full_text_exclusions != qualitative)
warning("After full-text exclusions, a different number of remaining ",
"articles for qualitative synthesis is stated.")
# apostrophes need to be replaced for grViz
labels <- lapply(labels, gsub, pattern = "'", replace = "&rsquo;")
dupes <- found + found_other - no_dupes
labels_orig <- list(
found = pnl("Records identified through",
Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-prisma.r
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ test_that("change a label", {
regexp = NA)
})

test_that("use an apostrophe in a label", {
expect_error(
prisma(found = 0,
found_other = 0,
no_dupes = 0,
screened = 0,
screen_exclusions = 0,
full_text = 0,
full_text_exclusions = 0,
qualitative = 0,
quantitative = 0,
labels = list(screened = "PLEASE DON'T RETURN AN ERROR")),
regexp = NA)
})

test_that("numbers must work together", {
expect_error(prisma(1, 2, 3, 4, 5, 6, 7, 8, 9))
expect_warning(prisma(1000, 20, 270, 270, 10, 260, 19, 240, 107))
Expand Down