anim_timespan {wpeR} | R Documentation |
Get dates of individuals first and last sample
Description
Takes data frame of all samples and returns the dates of individuals first and last sample. Besides that the functions determines if animal is dead based on predefined sample type eg. tissue.
Usage
anim_timespan(individual_id, sample_date, sample_type, dead = "Tissue")
Arguments
individual_id |
Column in the dataframe of all samples containing
individual animal identifier code.
Defined as |
sample_date |
Column in the dataframe of all samples containing
the date of sample collection.
Must be in |
sample_type |
Column in the dataframe of all samples containing the data
on the type (eg. scat, tissue, saliva) of particular sample.
Defined as |
dead |
Single value or vector of different lethal sample types. If no lethal
samples are included in the sampledata the dead parameter can be set to |
Value
A data frame with four columns and one row for each individual_id
.
Returned data frame columns correspond to individual identification key (ID
),
date of first (FirstSeen
) and last (LastSeen
) sample of individual and
logical (TRUE/FALSE
) value that identifies if the individual is dead (IsDead
).
Examples
anim_timespan(
individual_id = wolf_samples$AnimalRef,
sample_date = wolf_samples$Date,
sample_type = wolf_samples$SType,
dead = c("Tissue")
)