R is for
Authoring!!

OOH Session #121…
package
citations!!

Open Office Hours
(March 17, 2026)







Reminder – check it out!!

Fantastic resource!!

Recap of Session
#120:

Zotero

  1. ISBN, DOI (or other) identifier
  2. FileImport... – then find your .bib file(s)
  3. browser extensions/ connectors

Both have identical interface within the visual editor(s)

However – Zotero needs to be OPEN for Positron use – R Studio will find entries regardless of whether Zotero is currently open or not

  1. Find desired style (use Style Search)
  2. Click hyperlink to download
  3. Place in project directory
  4. Call out within YAML

Note

10,840 styles listed on Zotero Style Repository

---
title: "My Document"
format: pdf
bibliography: references.bib
csl: apa.csl
---
1
first–level specification unless using format: typst (see next tab)

use citeproc: true to force Pandoc citation processor – seemed to be more important for inline styling (end–of–document bibliography looked good)


---
title: "My Document"
format:
  typst:
    citeproc: true
    csl: apa.csl
bibliography: references.bib
---
1
Has been historically effective – forcing the “normal” Pandoc citation processor

Today…

package citations!!

knitr functions

  • .packages()
    • hidden (“dot” prefix)
  • write_bib()
    • will overwrite existing .bib file
    • use separate .bib for “other” citations

structure

Chunk:

knitr::write_bib(c
    (.packages(), 
      "ggplot2"), 
    "packages.bib")

YAML:

---
title: "Untitled"
format: html
bibliography: packages.bib
---

Session Info (March 17, 2026) Rendering:

R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.5.0    fastmap_1.2.0     cli_3.6.5         tools_4.5.0      
 [5] htmltools_0.5.8.1 otel_0.2.0        rstudioapi_0.18.0 yaml_2.3.12      
 [9] rmarkdown_2.30    knitr_1.51        jsonlite_2.0.0    xfun_0.56        
[13] digest_0.6.37     rlang_1.1.7       evaluate_1.0.5