Pooling data into weekly median bins

13 views Asked by At

I am working on determining four 'migration timing metrics': onset, peak, cessation, and duration of calls (whale song). I've started with peak because there can be low levels of calls recorded year-round, so the onset and cessation will be calculated as thresholds that encompass 90% of the total number of calls relative to the day with the peak number of calls.

I'm trying to pool the number of "calls" (which are currently seperated by by hour and 24hr) into weekly median bins and normalise the calls to be between 0 and 1 by scaling with the maximum number of daily calls per year.

I've worked out the peak # calls per year (where annual cycle is feb-jan) and (where daily calls is the number of calls per hour over 24 hrs for every day of the year) by

Peak<- Daily %>% group_by(annual_cycle) %>% summarise(Peak_Daily_calls= max(Daily_calls)) %>% arrange(annual_cycle)

But I havent pooled the calls into weekly median bins prior to determining the peak number of daily calls per year. So, I first need to figure this out (no idea how).

And, I also need to be able to determin which DOY (for each year (2001-2020) that the peak (max number of daily calls was on. Is there an easy way to do this in less steps than what I've tried?

These didnt work, #DOY in Daily == Peak$Peak_Daily_Calls Peak<- Daily %>% group_by(annual_cycle) %>% summarise(Peak_DOY = )

should I try an ifelse statement that finds the # of peak calls per year from the other data frame?

0

There are 0 answers