bib2bib | R Documentation |
The bib2bib
function reads a BibTeX file, replaces the journal field using a custom or
system-provided abbreviation table, optionally applies a function to the author field,
and writes the result back to a new BibTeX file.
bib2bib(
file,
out.file,
user_table = NULL,
use_sys_table = TRUE,
fun = NULL,
...
)
file |
A string representing the path to the input |
out.file |
A string representing the path where the output |
user_table |
A user-provided abbreviation table. It can be a file path (string),
a |
use_sys_table |
Logical. Whether to include the system abbreviation table ( |
fun |
A function (optional) to apply to the "author" field in the |
... |
Additional arguments passed to the custom function |
The function works in the following steps:
Reads a custom journal abbreviation table from a CSV file (if provided).
Reads the input BibTeX file and converts it into a data.table
.
Replaces the JOURNAL
field with abbreviations from the provided or system abbreviation table.
Optionally applies the provided function to the AUTHOR
field.
Writes the modified data back to a new BibTeX file.
None. The function writes the processed data to the specified output file.
bib_file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE)
csv_file <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE)
output_file <- tempfile(fileext = ".bib")
dt <- bib2bib(file = bib_file,
out.file = output_file,
user_table = csv_file,
use_sys_table = TRUE,
fun = function(x) {
gsub(" and ", " & ", x, perl = TRUE, ignore.case = TRUE)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.