## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>", eval = FALSE) ## ----setup-------------------------------------------------------------------- # library(retraction) ## ----------------------------------------------------------------------------- # retraction::retraction_knit_check(bib = "references.bib", on = "flagged", # action = "error") ## ----------------------------------------------------------------------------- # # Rscript -e 'retraction::retraction_main()' --fail-on=flagged,unchecked paper.bib # scan <- retraction_scan("paper.bib") # scan$n_flagged ## ----------------------------------------------------------------------------- # system.file("actions", "action.yml", package = "retraction") ## ----------------------------------------------------------------------------- # check_included_studies(c("10.1016/S0140-6736(97)11096-0", # "10.1136/bmj.331.7531.1512")) ## ----------------------------------------------------------------------------- # res <- check_file("review.bib") # retraction_watch_save(res, "my-review") # # # ... weeks later ... # newly <- retraction_watch_diff(check_file("review.bib"), "my-review") ## ----------------------------------------------------------------------------- # list_backends() # check_dois("10.1016/S0140-6736(97)11096-0", # sources = c("xera", "europepmc", "ncbi")) # compare_sources(check_dois("10.1126/science.aac4716", sources = "all")) ## ----------------------------------------------------------------------------- # res <- check_file("paper.bib") # explain_result(res) # a sentence per reference # exposure_score(res) # flagged rate with denominators # export_result(res, "results.xlsx") # or .csv / .json # annotate_bib("paper.bib", res) # write back a marked-up bibliography ## ----------------------------------------------------------------------------- # retraction_sync() # check_file("paper.bib", offline = TRUE) # snapshot_info() # # # Parallelism for large reference lists (set a future plan): # # future::plan("multisession"); check_dois(many_dois) # # p <- retraction_snapshot_parquet() # arrow::open_dataset(p) ## ----------------------------------------------------------------------------- # # _targets.R # library(targets) # list( # tar_target(bib, "paper.bib", format = "file"), # tar_target(checked, retraction::check_file(bib)), # tar_target(gate, if (nrow(retraction::retracted(checked, "flagged"))) # stop("retracted references present") else TRUE) # )