Skip to contents

Selects cross-org candidate/accepted edges (score_candidate_pairs(), link_cross_org()) by the coarse role (classify_title_role()) each endpoint held. Each edge endpoint is one within-org EMP_ID – one person's whole tenure at one organization – so an endpoint's role evidence is the set of roles it held across the years of that tenure (profiles$roles). This is a within-tenure union, not a union across organizations (the other org is the other endpoint).

Usage

filter_edges_by_role(
  edges,
  profiles,
  target = "BOARD",
  mode = c("any", "all", "primary"),
  match = c("both", "either"),
  negate = FALSE,
  annotate = TRUE
)

Arguments

edges

Edge table with emp_a, emp_b (e.g. link_cross_org()$edges).

profiles

Profiles those ids index (build_person_profile()); needs roles and primary_role.

target

Role class(es) to test against, from BOARD/OFFICER/STAFF/ OTHER.

mode

How to reduce an endpoint's role set: "any", "all", "primary".

match

Require the endpoint test on "both" ends or "either".

negate

Match endpoints not satisfying the target test.

annotate

Append roles_a, roles_b (the endpoints' role sets, +- joined) to the result for inspection.

Value

The subset of edges whose endpoints satisfy the predicate (with the annotation columns when annotate).

Details

Because a within-tenure role set can mix roles (a paid director who later took a board seat), mode controls how the set is reduced to a yes/no per endpoint:

any

Endpoint matches if it held any role in target (the union/"ever" behaviour – same as profiles$is_board for target="BOARD").

all

Endpoint matches only if every role it held is in target.

primary

Test only the modal role (profiles$primary_role).

negate = TRUE flips the per-endpoint test (matches endpoints not in target); combined with mode = "any" it means "never held a target role", the strict complement. match then requires the test to hold for both endpoints or either. An endpoint with no recorded role is treated as not in target.

Examples

if (FALSE) { # \dontrun{
xo <- link_cross_org(linked)
# strictly-paid interlocks (officer/staff only, no board, no volunteer OTHER):
filter_edges_by_role(xo$edges, xo$profiles,
                     target = c("OFFICER","STAFF"), mode = "all")
} # }