I have 3000 people in a dataset, each of them have Heart rate as a time-series. the time series interval is of 24 hours and in each hour there is max of 6 values, makes it max total of 24*6=144 values for each person (there is usually less). for every person I want to extract the number of "peeks" he has in the time interval.
I have checked and didn't find any function the calculate or give back more then the "absolute min/max" of the interval.
I have add an example of what I need, in the below graph although there is one absolute min and max, I need the whole four points (2 max and 2 min).
I really don't know how to extract this expect of creating my one function and using a lot of for-loops which isn't good.
can you help?
sample of the time-series:
dput(hr[1:20,])
structure(list(ID = c(5838L, 5838L, 5838L, 5838L, 5838L, 5838L,
5838L, 5838L, 5838L, 5838L, 5838L, 5838L, 5838L, 5838L, 5838L,
5983L, 5983L, 5983L, 5983L, 5983L), Heart.Rate = c(103L, 109L,
109L, 109L, 111L, 111L, 120L, 122L, 125L, 62L, 73L, 84L, 92L,
97L, 98L, 101L, 105L, 105L, 106L, 106L), Time = structure(c(1077080040,
1077083640, 1077084000, 1077084240, 1077083040, 1077085440, 1077082440,
1077081240, 1077081840, 1077086640, 1077087240, 1077084900, 1077080700,
1077080400, 1077086040, 1088496000, 1088494680, 1088495280, 1088498280,
1088504880), class = c("POSIXct", "POSIXt"), tzone = "UTC")), .Names = c("ID",
"Heart.Rate", "Time"), row.names = c(NA, 20L), class = "data.frame")