Open SteveLane opened 6 years ago
Thanks Steve. You're right that this is a tough problem. I can get to this in a few days, but in the meantime, revtools::start_review_window also accepts a data.frame, so you could import using a different method and just use revtools for visualisation. The columns you would need to include in your data.frame are:
No rush from me, was mainly playing. I think it's a great idea, and I look forward to updates.
Thanks for the tip, I'll give it a go.
Hi Steve - this took me a while to get back to, but I've updated this so that 1. read_bibliography detects .bib files more reliably, and 2. read_bib actually functions for the (fairly basic) cases that I've tried. If you get time to check it out and find more bugs then let me know. I'm going to keep checking this over the next week or so, so I won't close this issue just yet.
Hi Martin, Thanks for great seminar yesterday and exciting package. I also encountered an error (using cran version) reading in bib files, but after seeing this issue installed latest from GH and was able to read in a bib file and start an analysis.
However, the read_bibliography
function failed on another bib file I tried. This one had some custom sections and text in it. I looked into the failure and the parsing of the file via your regex expressions may have produced some unexpected results. This made me wonder: can you use the results of bibtex::read.bib
and work with that? As you may know, the resulting bibentry
has fields you can extract, e.g. bib[[1]]$title
etc:
> str(bib[[1]])
Class 'bibentry' hidden list of 1
$ Bruna-2010:List of 7
..$ title : chr "Scientific Journals Can Advance Tropical Biology and Conservation by Requiring Data Archiving"
..$ volume : chr "42"
..$ doi : chr "10.1111/j.1744-7429.2010.00652.x"
..$ journal: chr "Biotropica"
..$ author :Class 'person' hidden list of 1
.. ..$ :List of 5
.. .. ..$ given : chr [1:2] "Emilio" "M."
.. .. ..$ family : chr "Bruna"
.. .. ..$ role : NULL
.. .. ..$ email : NULL
.. .. ..$ comment: NULL
..$ year : chr "2010"
..$ pages : chr "399--401"
..- attr(*, "bibtype")= chr "Article"
..- attr(*, "key")= chr "Bruna-2010"
At least then you could offload the challenge of firstly reading in a bibfile?
I think there's going to be issues no matter what method is used to read in the bibfiles...
For example, I tried each of read_bibliography
, bibtex::read.bib
and RefManageR::ReadBib
to read in the following bibliography, and none of them could get the 'author' correct:
@MISC{biosec-act-2015,
title = "{Biosecurity Act 2015}",
author = "{Department of Agriculture and Water Resources}",
month = jun,
year = 2015,
url = "https://www.legislation.gov.au/Details/C2015A00061"
}
I'm currently running into this issue as well ... or a variant of it ... seems like my .bib file is pulling a function error? Error in if (any(col_n < 3)) { : missing value where TRUE/FALSE needed
That might be just due to an ugly .bib but I'm not really sure ... gonna try and just switch my data exports to .csv or .ris
(Hi @mjwestgate - rather than reopen issue #2 I thought I'd start a new one, reopen if you want)
bibfiles are tricky beasts! I wanted to try out your package for a new project, but can't get the bibfiles in.
RefManageR
reads them in ok as far as I can tell. Can you use that package (or a different one) to read them in, then parse from there into the format you require?I tried using the github version, with the following bib entry:
I should note, that I tried directly using
revtools:::read_bib
(asread_bibliography
wouldn't work with one citation, I assume due to the ris/bib checking).