Learn R Programming

journalabbr (version 0.3.1)

abbr2bib: Journal field abbreviation of BibTeX file

Description

Input Bib file with complete journal, output Bib file after abbreviation of journal, and return to the abbreviation table of journal

Usage

abbr2bib(
  file,
  outfile = tempfile(fileext = ".bib"),
  addcsvpath = "",
  csvsep = ";",
  csvheader = FALSE,
  ...
)

Arguments

file

character, input a .bib file.

outfile

character, file path to write the .bib file. An empty character string writes to stdout (default).

addcsvpath

path, Users can customize the path of journal abbreviation. The CSV file requires semicolon to segment data without header. The first column is the full name of the journal and the second column is the journal abbreviation.

csvsep

character, Customize the separator of CSV files. The default is semicolon, that is ;.

csvheader

logical, By default FALSE.

...

(generalized), Parameters from data.table::fread.

Value

output a new Bib file in the current directory, which only abbreviates the journal fields, and the rest remains unchanged. And return to a tibble, it has four columns:

JOURNAL

Original journal field in bib

journal_abbr

Field after abbreviation of original journal

originFile

Abbreviate the source of the database file, see https://github.com/JabRef/abbrv.jabref.org/tree/master/journals

is_abbr

There are only three cases, 1 represents that the item has a JOURNAL field and has been abbreviated successfully, - 1 means that the item does not have a JOURNAL field, and 0 represents that the item has a JOURNAL field, but the corresponding abbreviation is not found in the database, so the original JOURNAL field is used instead

Examples

Run this code
# NOT RUN {
require(journalabbr)
path = system.file("extdata", "testfile_1.bib", package = "journalabbr", mustWork = TRUE)
temptab = abbr2bib(file = path, outfile =  tempfile(fileext = ".bib"))

# add user csv
csvpath = system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE)
temptab1 = abbr2bib(file = path, outfile =  tempfile(fileext = ".bib"), addcsvpath = csvpath)

# }

Run the code above in your browser using DataLab