if (requireNamespace("bibtex")) {
file.name <- system.file("Bib", "biblatexExamples.bib", package="RefManageR")
bib <- suppressMessages(ReadBib(file.name))
bib1 <- bib[seq_len(44)]
bib2 <- bib[45:length(bib)]
## The following is FALSE because the parent entry of one entry in bib1
## is in bib2, so the child entry is expanded in the BibEntry object
## returned by `[` to include the fields inherited from the dropped parent
identical(merge(bib1, bib2, 'all'), bib)
toBiblatex(bib1[[1L]])
toBiblatex(bib[[1L]])
## Alternatively, the operator `[[` for BibEntry objects does not expand
## cross references
bib1 <- bib[[seq_len(44)]]
bib2 <- bib[[45:length(bib)]]
identical(merge(bib1, bib2, 'all'), bib)
## Not strict enough
invisible(merge(bib1, bib2, c('title', 'date')))
}
## New publications of R.J. Carroll from Google Scholar and Crossref
if (FALSE) {
if (requireNamespace("bibtex")) {
bib1 <- ReadGS(scholar.id = "CJOHNoQAAAAJ", limit = '10', sort.by.date = TRUE)
bib2 <- ReadCrossRef(query = "rj carroll", limit = 10, sort = "relevance",
min.relevance = 80)
oldopt <- BibOptions(merge.fields.to.check = "title")
rjc.new.pubs <- bib1 + bib2
BibOptions(oldopt)
}
}
Run the code above in your browser using DataLab