Given a bibliography file, this function will generate bibliographic entries for one or more types of bib entry.

bibliography_entries(file, startlabel = NULL, endlabel = NULL)

Arguments

file

A path to a bibliography file understood by rmarkdown::pandoc_citeproc_convert().

startlabel

Defunct.

endlabel

Defunct.

Value

A dataset representing the bibliographic entries, suitable for generating a reference section in a document.

Author

Mitchell O'Hara-Wild & Rob J Hyndman

Examples

# Create a bibliography from a set of packages
bib <- tempfile(fileext = ".bib")
knitr::write_bib(c("vitae", "tibble"), bib)

# Import the bibliography entries into a CV
bibliography_entries(bib)
#> # A tibble:   2 × 8
#> # vitae type: bibliography entries
#>   URL                    author     id    issued note  title `title-short` type 
#>   <chr>                  <lst_f_c_> <chr> <csl_> <chr> <chr> <chr>         <chr>
#> 1 https://tibble.tidyve… Kirill Mü… R-ti…   2023 R pa… Tibb… Tibble        book 
#> 2 https://pkg.mitchello… Mitchell … R-vi…   2024 R pa… Vita… Vitae         book 

# The order of these entries can be customised using `dplyr::arrange()`
bibliography_entries(bib) %>%
  arrange(desc(title))
#> # A tibble:   2 × 8
#> # vitae type: bibliography entries
#>   URL                    author     id    issued note  title `title-short` type 
#> * <chr>                  <lst_f_c_> <chr> <csl_> <chr> <chr> <chr>         <chr>
#> 1 https://pkg.mitchello… Mitchell … R-vi…   2024 R pa… Vita… Vitae         book 
#> 2 https://tibble.tidyve… Kirill Mü… R-ti…   2023 R pa… Tibb… Tibble        book 

# For more complex fields like author, you can also sort by component fields.
# For example, use `author$family` to sort by family names.
bibliography_entries(bib) %>%
  arrange(desc(author$family))
#> # A tibble:   2 × 8
#> # vitae type: bibliography entries
#>   URL                    author     id    issued note  title `title-short` type 
#> * <chr>                  <lst_f_c_> <chr> <csl_> <chr> <chr> <chr>         <chr>
#> 1 https://pkg.mitchello… Mitchell … R-vi…   2024 R pa… Vita… Vitae         book 
#> 2 https://tibble.tidyve… Kirill Mü… R-ti…   2023 R pa… Tibb… Tibble        book