indivsInfo_ExtractMaxAge: Extract age for each individual at end of life or model run

View source: R/indivsInfo_ExtractMaxAge.R

indivsInfo_ExtractMaxAgeR Documentation

Extract age for each individual at end of life or model run

Description

Function to extract age for each individual at end of life or model run.

Usage

indivsInfo_ExtractMaxAge(sf_EndByStage)

Arguments

sf_EndByStage

- sf dataframe returned by indivsInfo_ExtractEndByStage or indivsInfo_ExtractStartEndByStage

Details

The input sf dataframe should be the output of indivsInfo_ExtractEndByStage or indivsInfo_ExtractStartEndByStage.

The end of the model run or death is basically identified by the record where age==max(age) for each origID, endID pair. However, a straightforward application of this approach would "double count" individuals which changed id's during the course of their lifetime, because the "original" individual (with id = origID) appears to have died when it metamorphoses (origID stays the same, but id changes to a new unique value). Consequently, individuals which have origID=endID are removed if there are any other individuals with the same origID but different endIDs.

Value

tibble dataframe with columns:

  • startTime

  • origID - original (starting) individual ID

  • endID - individual ID at end

  • maxAge - ending age(d)


wStockhausen/rDisMELS documentation built on March 27, 2022, 1 a.m.