Skip to contents

Vectorized classifier mapping each title.standard value to one of BOARD, OFFICER, STAFF, OTHER (see title_role). Precedence is overrides, then BOARD, then OFFICER, then STAFF, then OTHER.

Usage

classify_title_role(title, overrides = NULL, levels = TRUE)

Arguments

title

Character vector of titles (any case; whitespace is squished).

overrides

Optional named character vector mapping an exact normalized title to a role, e.g. c("SERGEANT AT ARMS" = "BOARD"). Overrides win over every rule, so this is the one-line escape hatch for tail cases the rules get wrong. Names are matched after the same normalization applied to title.

levels

If TRUE (default) return a factor with levels c("BOARD","OFFICER","STAFF","OTHER"); otherwise a character vector.

Value

A factor (or character vector) the same length as title; NA titles map to NA.

See also

title_role_coverage() to audit a whole vocabulary.

Examples

classify_title_role(c("BOARD PRESIDENT", "BOARD SECRETARY", "TREASURER",
                       "CHIEF FINANCIAL OFFICER", "EXECUTIVE DIRECTOR",
                       "VICE PRESIDENT", "VICE PRESIDENT OF FINANCE",
                       "DIRECTOR OF MARKETING", "CHAPLAIN"))
#> [1] BOARD   BOARD   BOARD   OFFICER OFFICER BOARD   STAFF   STAFF   OTHER  
#> Levels: BOARD OFFICER STAFF OTHER