https://github.com/dark-peak-analytics/bibby

R package to work with bibtex in automated reporting

https://github.com/dark-peak-analytics/bibby

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

R package to work with bibtex in automated reporting

Basic Info
  • Host: GitHub
  • Owner: dark-peak-analytics
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Size: 58.6 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 4
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

bibby

R-CMD-check

Background

A common problem when working with automated or semi-automated reports is the need to manage references alongside input parameters and other data. For example if I have a model that has costs from Williams et al. (2020) and I want to change the cost of that intervention to be from Jameson et al. (2024) then I would want the value to be updated in the model, but also the reference to be updated in the report.

| Label | Value | Reference | |-------------------|-------|------------------------| | Cost of something | \$100 | Williams et al. (2020) |

This package is designed to help with that problem, by allowing users to provide references in a data frame (likely read in from Excel). This means that users who are not R programmers can easily update parameter values and references in the input tables and re-run the R code (either automated or semi-automated) to update the report with the new values and references.

Overview

The bibby package provides functions to work with bibtex entries in R. The benefit is automated updates of references in R Markdown documents (.Rmd) if new references are added or existing ones are updated. The downside is that it requires users to enter the references as BiBTeX entries in the input tables, which may not be familiar to all users.

| Label | Value | Reference | |-------------------------------|-----------------|------------------------| | Cost of something | \$100 | '@article{williams2020costofsomething, title={Cost of something in something else}, author={Williams, John and Smith, Jane},journal={New England Journal of Medicine},volume={377},number={10},pages={936--946},year={2020},publisher={Mass Medical Soc}}' |

It does two things:

1) The BiBTeX entries provided in tables are replaced with tags suitable for .Rmd.

2) The bibtex entries are written to a .bib file which is used by the .Rmd document to generate the bibliography.

There is no need to manually edit the .bib file, as the package will automatically update the .bib file with the new entries. This means that users can easily update the references in their input tables and re-run the R code to update the report with the new values and references.

This process can be embedded into automated workflows, shiny or with databases such as DuckDB or SQLite. The package is designed to be simple to use and flexible, allowing users to easily manage their references in R.

Installation

The development version of assertHE can be installed from GitHub with:

``` r

install.packages("devtools")

devtools::install_github("dark-peak-analytics/bibby")

library(bibby) ```

Use

Hopefully simple to use. Just specify the bibtex entry and the output type required.

For example the code below should return the bibtex tag for the entry ("@smith2020making").

``` r

extractbibtextag( bibtexentry = "@article{smith2020making, title={Making health economic models Shiny: A tutorial}, author={Smith, Robert and Schneider, Paul}, journal={Wellcome open research}, volume={5}, pages={69}, year={2020}}", output = "markdownlong")

Returns:

"@smith2020making"

```

If you have a list of bibtex entries, you can then use the update_bib_file_from_vector function to update a .bib file with the new entries. For example the code below will update the file bibby_refs.bib with the new entries (creating it if the file doesn't exist). The verbose argument will print the new entries to the console. The function also returns the bibtex tags of all entries for use in other functions.

``` r

updatebibfilefromvector(path = "bibbyrefs.bib", vbibtexentries = bibby::vexamplerefs, verbose = TRUE, outputtype = "markdown_short" )

Returns:

[1] "[@smith2020making]" "[@tordrup2022global]" "[@xie2015]" "[@baio2017bceaweb]" "[@gmailr]"

[6] "[@baio2017bceaweb2]" "[@hart2020r]" "(Assumption)"

And fills the file bibby_refs.bib with the original BiBTeX.

```

This is a beta version of the package, so please report any issues or suggestions. We are using this on several client projects and it is working well, but we are always looking for ways to improve the package and make it more useful for users.

Get in contact

To get in contact about this project or other collaborations please feel free to email me at rsmith\@darkpeakanalytics.com{.email}.

Owner

  • Name: Dark Peak Analytics
  • Login: dark-peak-analytics
  • Kind: organization
  • Email: contact@darkpeakanalytics.com
  • Location: United Kingdom

Consulting at the intersection of health economics and data science.

GitHub Events

Total
  • Issues event: 1
  • Push event: 3
  • Public event: 1
  • Pull request review event: 1
  • Pull request event: 3
  • Create event: 3
Last Year
  • Issues event: 1
  • Push event: 3
  • Public event: 1
  • Pull request review event: 1
  • Pull request event: 3
  • Create event: 3

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v5 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 2.10 depends
  • testthat >= 3.0.0 suggests