
Detect career transitions
detect_career_transition.RdCollapses each entity's history into spells of consecutive periods in the
same group, then pairs each spell with the one that follows it. A row is
dated by ref_date, the period in which the entity is first observed in the
destination group, so a transition is counted when it happens. from_date
records when the origin spell began.
Arguments
- data
Data frame containing a
ref_datecolumn, the identifier and the grouping columns.- id_col
Character. Column identifying the entity whose career is tracked. Default
"contract_id".- group_cols
Character vector of columns defining the career position (e.g. paygrade, department). Multiple columns are pasted into one label.
- return_all
Logical. Keep terminal spells, which have no destination and so carry
NAin bothtoandref_date. DefaultFALSE.