Skip to contents

Subset a corpus by filtering works on year, type, OA status, or custom expressions.

Usage

sm_filter_works(corpus, ..., year_range = NULL, types = NULL, oa_only = FALSE)

Arguments

corpus

An sm_corpus object.

...

Filtering expressions passed to dplyr::filter(), evaluated in the context of the works tibble.

year_range

Optional two-element integer vector for year filtering.

types

Optional character vector of document types to keep.

oa_only

Logical; keep only open access works?

Value

An sm_corpus with the filtered subset.

See also

Other filters: sm_query()

Examples

corpus <- sm_example_corpus()
filtered <- sm_filter_works(corpus, year_range = c(2020, 2024))
nrow(filtered$works)
#> [1] 110