'Create a 3 day HR slope column based on date column in R
Data frame looks like this:
DATE Athlete HR
2020/07/31 Athlete 1 56
2020/07/30 Athlete 1 58
2020/07/29 Athlete 1 64
2020/07/28 Athlete 1 36
2020/07/27 Athlete 1 57
2020/07/26 Athlete 1 66
2020/07/25 Athlete 1 69
Have looked into rollapplyr() and slope() but unsure on how to use these functions in order to get a 3 day slope for HR data column using the dates column?
Was thinking that maybe I would have to create a function and use slope() within the function in order to calculate the 3 day but unsure how to do it.
Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
