Type: Package
Title: Correct and Standardize References for Scientific Manuscripts
Version: 0.0.2
Description: Reads 'Word' documents containing incomplete bibliographic references and produces an updated file with standardized and complete references. The package provides functions to retrieve missing authors, titles, journal details, volume, issue, and page numbers. Digital object identifiers (DOIs) are retrieved using the 'CrossRef' application programming interface (API) https://api.crossref.org, and references are formatted following DOI-based citation standards as described by Paskin (2010) <doi:10.1000/182> and the 'citation.doi.org' service https://citation.doi.org. The package is intended to simplify reference preparation for scientific journal submissions.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Depends: R (≥ 4.1.0)
Imports: httr, jsonlite, stringr, officer
NeedsCompilation: no
Packaged: 2026-01-08 14:38:32 UTC; DR. Umar Hussain
Author: Umar Hussain [aut, cre]
Maintainer: Umar Hussain <drumarhussain@gmail.com>
Repository: CRAN
Date/Publication: 2026-01-12 18:50:26 UTC

Correct and Standardize References in a 'Word' Document

Description

Reads a 'Word' document containing bibliographic references with missing or incomplete information (e.g., authors, title, year, volume, issue, or page numbers) and produces an updated document with standardized and completed references. Missing metadata are retrieved using the 'CrossRef' application programming interface (API), and digital object identifiers (DOIs) are added where available.

Usage

correct_ref(input_path, output_path, reference_lines = 50, style = "vancouver")

Arguments

input_path

Character string specifying the path to the input 'Word' (.docx) document containing incomplete references.

output_path

Character string specifying the path where the corrected 'Word' document will be written.

reference_lines

Integer specifying the number of lines at the end of the document that are treated as references.

style

Character string specifying the reference style (e.g., "vancouver").

Value

Writes a corrected 'Word' document to the location specified by output_path. The function returns invisible(NULL).

Examples


library(officer)

# Step 1: Create a temporary Word document with sample references
tmp_input <- file.path(tempdir(), "tmp_refs.docx")
doc <- read_docx()
doc <- body_add_par(doc, "1. Smith J. Some article. 2020;10(2):123-9.", style = "Normal")
doc <- body_add_par(doc, "2. Doe A. Another article. 2021;5(1):10-5.", style = "Normal")
print(doc, target = tmp_input)

# Step 2: Specify output path
tmp_output <- file.path(tempdir(), "updated_refs.docx")

# Step 3: Run the reference correction function
correct_ref(
  input_path = tmp_input,
  output_path = tmp_output,
  reference_lines = 2,
  style = "vancouver"
)

# Step 4: The corrected Word file is saved in tmp_output
tmp_output