filter_refs: Filter a Data Frame of Citations and Return the Entries as a...

View source: R/filter_refs.R

filter_refsR Documentation

Filter a Data Frame of Citations and Return the Entries as a Character

Description

filter_refs() is a convenience function I wrote for filtering a data frame of citations returning the entries as a valid .bib entry (as a character vector). I wrote this for more easily passing on citations to the print_refs() function also included in this package.

Usage

filter_refs(bibdat, criteria, type = "bibtexkey")

Arguments

bibdat

a data frame of citations, like the one created by the bib2df package

criteria

criteria, specified as a character vector, by which to filter the data frame of citations

type

the particular type of citation entry on which to filter. Defaults to "bibtexkey" (which filters based on a column of unique citation keys). When type == "year", the function filters on a character vector of years.

Details

filter_refs() assumes some familiarity with BibTeX, .bib entries, and depends on the bib2df package.

Value

filter_refs() takes a data frame of citations, like the one created by the bib2df package, and returns a character vector (amounting to a valid .bib entry) of citations the user wants. This can then be easily passed to the print_refs() function also included in this package.

Examples

# Based on `stevepubs` configuration, filter on `BIBTEXKEY` where
# the citation key matches one of these.
filter_refs(stevepubs, c("miller2017etst", "miller2017etjc", "miller2013tdpi"))

# Based on `stevepubs` configuration, filter on `YEAR` where
# the publication year is 2017, 2018, 2019, 2020, or 2021.
filter_refs(stevepubs, c(2017:2021), type = "year")

svmiller/stevemisc documentation built on Jan. 31, 2024, 2:02 p.m.