first_turnover: first_turnover() computes the last time an element is...

View source: R/first_turnover.R

first_turnoverR Documentation

first_turnover() computes the last time an element is observed in a list

Description

first_turnover() computes the last time an element is observed in a list

Usage

first_turnover(a)

Arguments

a

numeric vector such as year, or ordered number

Details

sequence function to identify a year an ordering index

Value

a numeric vector

Examples

library(dplyr)
person_sequence <- stacked_data %>%
                   dplyr::select(year, id_j, id_i, id_ij) %>%
                   unique() %>%
                   group_by(id_ij) %>%
                   summarise(start = min(year), final = first_turnover(year)) %>%
                   mutate(time = final - start + 1)


dacarras/r4sda documentation built on Nov. 9, 2023, 10:17 a.m.