Merges two BibEntry objects comparing only the specified fields to detect
duplicates, thus it is can be made less strict
than using duplicated
, unique
, etc. Attributes are also merged
and keys are ensured to be unique.
merge
and +
simply provide different interfaces for merging.
# S3 method for BibEntry
+(e1, e2)# S3 method for BibEntry
merge(x, y,
fields.to.check = BibOptions()$merge.fields.to.check,
ignore.case = BibOptions()$ignore.case, ...)
BibEntry object
BibEntry object to be merged with e1
BibEntry object
BibEntry object
character vector; which BibLaTeX fields should be
checked to determine if an entry
is a duplicate? Can include "bibtype"
to check entry type and
"key"
to check entry keys. Specifying "all"
checks all fields
using duplicated
.
logical; if TRUE
, case is ignored when determining
if fields are duplicates.
ignored
an object of class BibEntry
Other operators: $.BibEntry
,
$<-.BibEntry
, [.BibEntry
,
[<-.BibEntry
, [[.BibEntry
,
[[<-.BibEntry
, c.BibEntry
# NOT RUN {
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
# }
# NOT RUN {
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