read_bib2dt | R Documentation |
data.table
.The BibTeX file is read, parsed, tidied and written to a data.table
.
read_bib2dt(file, encoding = "UTF-8")
file |
character, path or URL to a bib file. |
encoding |
character, encoding to be passed to |
Read, parse and collate bibtex file to form a data.table. Different BIB may produce different data.table columns.
A data.table
.
ShuCai Zou
readLines
for more details on reading text files.
# Read from .bib file:
require(journalabbr)
require(purrr)
require(data.table)
file1 <- system.file("extdata", "testfile_1.bib", package = "journalabbr", mustWork = TRUE)
dt1 <- read_bib2dt(file1)
colnames(dt1)
file2 <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE)
dt2 <- read_bib2dt(file2)
colnames(dt2)
# A valid BibTeX entry as a character vector
item1 <- c(
"@Article{switalski2003general,",
"author = {Switalski, Zbigniew},",
"journal = {Fuzzy Sets and Systems},",
"title = {General transitivity conditions for fuzzy reciprocal preference matrices},",
"year = {2003},",
"number = {1},",
"pages = {85--100},",
"volume = {137},",
"publisher = {Elsevier},",
"}"
)
item2 <- c(
"@Article{switalski2003general,",
"author = {Switalski, Zbigniew},",
"journal = {Fuzzy Sets and Systems},",
"title = {General transitivity conditions for fuzzy reciprocal preference matrices},",
"year = {2003}}"
)
item3 <- c(
"@Article{switalski2003general,",
"author = {Switalski, Zbigniew},",
"journal = {Fuzzy Sets and Systems},",
"title = {General transitivity conditions for fuzzy reciprocal preference matrices},",
"year = {2003}"
)
item = list(item1, item2, item3)
# Check validity of the entries (inner function)
map(item, journalabbr:::checkitem_valid)
map(item, journalabbr:::extract_fields)
rbindlist(map(item, journalabbr:::extract_fields), fill=TRUE, use.names = TRUE)
rbindlist(map(item, journalabbr:::extract_fields, check=TRUE), fill=TRUE, use.names = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.