Adds a logical award_match column to a results tibble, set to TRUE for
rows where any element of grant_numbers matches any of the supplied
patterns. Useful for identifying records funded under a specific contract
structure when the funder name alone is ambiguous or inconsistently recorded.
Arguments
- pubs
A
tibble::tibble()returned by anypc_search_*()function.- pattern
Character vector. One or more regular expressions matched case-insensitively against each element of
grant_numbers. A row is flaggedTRUEif any grant number matches any pattern. For examplec("^4600", "^W912")flags both DWR and USACE contracts.
Value
The input tibble with an award_match logical column appended.
Rows with no grant numbers always return FALSE.
Details
Award ID patterns are often more reliable than funder name strings because
they are structured and consistent. For example, California Department of
Water Resources contracts follow a 4600XXXXXX format; U.S. Army Corps of
Engineers contracts begin with W912.
Examples
if (FALSE) { # \dontrun{
pubs <- pc_search_scopus("California Department of Water Resources",
field = "funder")
# Single pattern
pubs <- pc_flag_awards(pubs, "^4600")
# Multiple patterns
pubs <- pc_flag_awards(pubs, c("^4600", "^W912"))
pubs[pubs$award_match, ]
} # }