Skip to contents

Tidy summary of the matches produced by sm_affiliation_match(), mirroring the audit-style summaries elsewhere in the package: counts of works and authorships flagged, broken down by institution and by match_signal.

Usage

sm_affiliation_summary(corpus, call = rlang::caller_env())

Arguments

corpus

An sm_corpus previously passed through sm_affiliation_match() (so its authorships carry institution_match and match_signal).

call

Caller environment for error reporting.

Value

A tibble with columns institution, match_signal (a factor; see sm_affiliation_signals()), n_authorships, n_works, and example_evidence (a representative matched-evidence string for that institution x signal — the audit trail), sorted by n_authorships descending. Type-stable: a 0-row tibble (with a warning) when no matches are present.

Examples

corpus <- sm_example_corpus(n_works = 5, n_authors = 5)
corpus$authorships$raw_affiliation[1] <- "Bundeswehrkrankenhaus Berlin"
corpus <- sm_affiliation_match(corpus)
#>  Affiliation matching flagged 1 authorship across 1 institution.
#>  By signal: name_token: 1. See `sm_affiliation_summary()` for the full
#>   breakdown.
sm_affiliation_summary(corpus)
#> # A tibble: 1 × 5
#>   institution         match_signal n_authorships n_works example_evidence     
#>   <chr>               <fct>                <int>   <int> <chr>                
#> 1 Bundeswehr Hospital name_token               1       1 Bundeswehrkrankenhaus