Learn R Programming

boilerplate (version 1.3.0)

boilerplate_add_bibliography: Add Bibliography to Database

Description

Adds or updates bibliography information in a boilerplate database.

Usage

boilerplate_add_bibliography(db, url, local_path = NULL, validate = TRUE)

Value

Updated database object

Arguments

db

Database object

url

URL to the bibliography file

local_path

Local filename to use when copying (default: basename of URL)

validate

Whether to validate citations on updates

Examples

Run this code
# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)

# Initialise and import
boilerplate_init(data_path = temp_dir, create_dirs = TRUE, confirm = FALSE, quiet = TRUE)
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)

# Add bibliography
# Using the example bibliography included with the package
example_bib <- system.file("extdata", "example_references.bib", package = "boilerplate")
db <- boilerplate_add_bibliography(
  db,
  url = paste0("file://", example_bib),
  local_path = "references.bib"
)

# Save the updated database
boilerplate_save(db, data_path = temp_dir, confirm = FALSE, quiet = TRUE)

# Clean up
unlink(temp_dir, recursive = TRUE)
# }

Run the code above in your browser using DataLab