I have two versions of a bibtex database which have gotten badly out of sync. I need to find find all the entries in
bib2 which are not contained in bib1, according to their bibtex keys.
But I can't figure out how to extract a list of the bibentry keys in these databases.

A minor question: Is there someway to prevent read.bib from ignoring entries that do not contain all required fields?

A suggestion: it would be nice if bibtex provided some extractor functions for bibentry fields.

> bib1 <- read.bib("C:/localtexmf/bibtex/bib/timeref.bib")
ignoring entry 'Donoho-etal:1988' (line 40) because :
A bibentry of bibtype ‘InCollection’ has to correctly specify the field(s): booktitle
... snipping other similar warnings ...

> length(bib1)
[1] 628
>
> bib2 <- read.bib("W:/texmf/bibtex/bib/timeref.bib")
ignoring entry 'Donoho-etal:1988' (line 57) because :
A bibentry of bibtype ‘InCollection’ has to correctly specify the field(s): booktitle
... snipping other similar warnings ...

> length(bib2)
[1] 611

# The first bibentry:
> bib1[[1]]
Godfrey EH (1918). “History and Development of Statistics in Canada.” In Koren J (ed.), pp.
179-198. Macmillan, New York.
> str(bib1[[1]])
Class 'bibentry' hidden list of 1
$ :List of 9
..$ author :Class 'person' hidden list of 1
.. ..$ :List of 5
.. .. ..$ given : chr [1:2] "Ernest" "H."
.. .. ..$ family : chr "Godfrey"
.. .. ..$ role : NULL
.. .. ..$ email : NULL
.. .. ..$ comment: NULL
..$ title : chr "History and Development of Statistics in {Canada}"
..$ booktitle: chr "History of Statistics, their Development and Progress in Many Countries"
..$ publisher: chr "Macmillan"
..$ year : chr "1918"
..$ editor :Class 'person' hidden list of 1
.. ..$ :List of 5
.. .. ..$ given : chr "John"
.. .. ..$ family : chr "Koren"
.. .. ..$ role : NULL
.. .. ..$ email : NULL
.. .. ..$ comment: NULL
..$ pages : chr "179--198"
..$ address : chr "New York"
..$ crossref : chr "Koren:1918"
..- attr(*, "bibtype")= chr "InCollection"
..- attr(*, "key")= chr "Godfrey:1918"

So, I try to get the "key" attribute for this entry, but it returns NULL, and I don't understand why.
> attr(bib1[[1]], "key")
NULL
> attr(bib1[1], "key")
NULL

-Michael

--
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to