I need some help to automatically list all *.bib files in ../bib
directory for bibliography field in Rmd YAML using list.files()
function.
I have three bib files ("a.bib", "b.bib", "c.bib") in ../bib directory. Without having to manually type in every file name in bibliography field of YAML, I would like to automatically parse each bib file name with its relative path for the field so that I just simply add more bib files in the "bib" directory whenever I need more references. I have tried some possible code like below; however, it failed. Any help would be greatly appreciated.
---
title: "Test Document"
output: pdf_document
bibliography: ['`r paste0("bib/", list.files("bib", pattern = "(*.bib)$"))`']
---
# Intro
This is test.
I would like to have the bibliography
field in YAML is filled with the existing *.bib file name list (with their relative path) as follows:
bibliography: ["bib/a.bib", "bib/b.bib", "bib/c.bib"]