| Title: | Append DOIs to References in Word Documents |
| Version: | 0.1.0 |
| Description: | Read 'Word' documents containing bibliographic references, search for corresponding DOIs using the 'Crossref' API, and append the retrieved DOIs directly to the references. Supports parallel processing for faster retrieval and produces a new 'Word' document with numbered references including DOIs. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Imports: | httr, jsonlite, officer, dplyr |
| Suggests: | knitr, rmarkdown |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2025-12-08 09:17:20 UTC; DR. Umar Hussain |
| Author: | Umar Hussain [aut, cre] |
| Maintainer: | Umar Hussain <drumarhussain@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-12 21:30:18 UTC |
Add DOIs to References in a Word Document
Description
This function reads a 'Word' document containing bibliographic references, fetches their corresponding DOIs via the 'CrossRef' API, and writes a new 'Word' document with the DOIs appended to each reference.
Usage
add_doi(input_path, output_path, reference_lines = 50)
Arguments
input_path |
Character. Path to the input 'Word' document (.docx) containing references. Can be absolute (e.g., "C:/Users/.../references.docx") or relative (e.g., "./references.docx"). |
output_path |
Character. Path where the output 'Word' document with DOIs will be saved. If the file exists, it will be overwritten. |
reference_lines |
Numeric. Number of lines from the end of the document to treat as references. Default is 50. Only lines with more than 30 characters are processed. |
Value
Character vector of references with appended DOIs. References that could not be matched return "NA".
Examples
# Basic usage: fetch DOIs for last 50 lines in a 'Word' document
add_doi(
input_path = "E:/references.docx",
output_path = "E:/references_doi.docx",
reference_lines = 50
)
# Notes:
# - input_path must exist and contain references.
# - output_path will be overwritten if it exists.
# - Some references may return DOI "NA" if not found on 'CrossRef'.