Andy.Jian Andy.Jian -4 years ago 160
R Question

Any way of attaching .csl, .bib files by using `knitcitations` package?

I have tried to attach

bibliography.bib, nature.csl
files by using
knitcitations
packages on
myPkg_vignette.Rmd
, but when I execute the .Rmd file, I got following error:

pandoc-citeproc.exe: Could not find bibliography.bib
pandoc.exe: Error running filter pandoc-citeproc
Filter returned error status 1
Error: pandoc document conversion failed with error


I looked into
knitcitations
manual and how to attach
.csl, .bib
file by handy, but I got warning and can't attach these files on
myPkg_vignette.Rmd
.

Edit :

This is context of
bibliography.bib
:

@article{Vahid_Jalili_Musera_2015,
title = "MuSERA: Multiple Sample Enriched Region Assessment",
author = {Vahid Jalili, Matteo Matteucci, Marco Masseroli, Marco J. Morelli},
journal = "Briefings in Bioinformatics",
year = "2016",
pages = "1-15",
url = {http://bib.oxfordjournals.org/content/early/2016/03/23/bib.bbw029.abstract?keytype=ref&ijkey=8IlROGziM9XA7NS},
doi = "10.1093/bib/bbw029 ",
}


How can I attach
bibliography.bib
,
nature.csl
on package's vignette easily ? I read some post in SO and I confused about the given solution. I am quite new with using
knitcitations
packages, and I may get wrong with attaching
.bib, .csl files
in right way. Can any one help me out how to address this issues in Rstudio ? Any idea ? Thanks a lot :)

NEW EDIT :

I've read this post and followed the solution :

setwd('C:/Users/me/Documents/myPkg')
Sys.setenv(TEXINPUTS=getwd(),
BIBINPUTS=getwd(),
BSTINPUTS=getwd())


but bibliography.bib is not printed in .Rmd file. I changed the global option for weaving Rnw file to knitr. How can I print out bibliography on .Rmd file ? Any further help please ?

Answer Source

As with Dirk, it just works for me. Maybe you didn't put the YAML together properly, or maybe you never cited anything. Here's a sample document that works with your bib file:

---
title: "Biblio Example"
output: html_document
bibliography: bibliography.bib
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Here's Some Text

This text cites the paper:  [@Vahid_Jalili_Musera_2015].

## References

The bibliography will appear by magic at the end of the document, just
below this text.

See http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html for more details.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download