Finding midpoint between one observation and another in R -


i have data on bird parental care , cannot work out how information require them.

i need take midway between last observation parent (4) , first observation when parent not family (3 = female care only, 2 = male care only), eg:

date      parent   chick age 509        4             0 510        2             1 515        3             6 516        3             7 517        no chicks 

so above set of data find: duration of male care duration of female care

can me understand how go doing this? in advance , please feel free ask me clarify things if way i've worded doesn't make sense, i'm new r!

assuming there's single dataframe per chick , there's 1 care transition family male or female, calculation done follows:

male_care_duration = min(chicks[chicks['parent']==2,]$datestamp, na.rm=true) - max(chicks[chicks['parent']==4,]$datestamp, na.rm=true)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -