NeoSurvData: Conversion of neonate data into the proper format for...

Description Usage Arguments Value Examples

View source: R/NeoSurvData.R

Description

Convert capture data of neonates into the proper format for conducting survival analysis. This function will return 2 columns of data: survival time of each in whatever units desired (days, weeks, months, etc.) and an indicator column of whether the event (i.e. mortality) occurred in binary format. Further, this function allows the option to use a cutoff age for modeling survival. For instance, in many cases survival of neonatal ungulates is modeled to 140 days.

Usage

1
NeoSurvData(NeoDat, units, cuts, cutoffs, Cause)

Arguments

NeoDat

data.frame of capture data. Should contain a column of the day an animal began being monitored (must be named StartDate and in Date format), a column of animal mortality date or or current date if individual still alive (must be named EndDate and in Date format), and a column identifying cause of mortality.

units

Units desired for modeling survival (e.g. days, weeks, etc)

cuts

= Logical. TRUE/FALSE. Whether you desire to use a cutoff date for survival

cutoffs

Vector of cutoffs in units desired (e.g. 140 days, indicate 140)

Cause

Vector of causes in your data.frame in which events should be censored (i.e. Collar_Failure)

Value

Returns a data.frame with original data.frame with a column of survival time (DiffTime) and indicator of whether event occurred (Indicator)

Examples

1
NeoSurv<-NeoSurvDat(NeoDat = yourdata, units = "days", cuts = TRUE, cutoffs = 140, Cause = "collar_failure")

khuggler/TediousEcology documentation built on July 10, 2021, 12:34 a.m.