Skip to contents

Joins the cross-org assignment (link_cross_org()) onto the original record-level panel by EMP_ID, so every filing row of a real person – across every organization and tax year – carries one XORG_ID. Grouping the stamped panel by XORG_ID then recovers a person's complete title/year history across organizations (grouping by EMP_ID gives it within a single organization).

Usage

stamp_xorg(
  df,
  x,
  emp_id = "EMP_ID",
  cols = c("XORG_ID", "XORG_N_ORGS", "XORG_N_TITLES", "XORG_N_YEARS", "XORG_N_RECORDS")
)

Arguments

df

The record-level panel that was linked (carries EMP_ID).

x

Either the assignment data frame from link_cross_org() or the full link_cross_org() result list (its $assignment is used).

emp_id

Name of the person-cluster id column (default "EMP_ID").

cols

Cross-org columns to copy over; defaults to all present in the assignment (XORG_ID, XORG_N_ORGS, XORG_N_TITLES, XORG_N_YEARS, XORG_N_RECORDS).

Value

df with the requested cross-org columns added. Rows whose EMP_ID is absent from the assignment get NA (and a warning).

See also

Examples

if (FALSE) { # \dontrun{
xo <- link_cross_org(linked)
panel <- stamp_xorg(linked, xo)
# a person's full cross-org title history:
subset(panel, XORG_ID == panel$XORG_ID[1])[, c("ein","taxyr","title.standard")]
} # }