I have the following data frame in R :
Time A
1 1
2 1
3 1
4 1
5 2
6 2
7 3
8 3
9 2
10 1
11 1
12 1
13 3
14 3
15 3
Let's consider numbers in Time
column are second, i need to define a window of 3 seconds, and apply two or three different methods to A
column and have the results for each function in separate columns, lets consider first function is Average, second function is max like this:
Time-window average max
1 1 1
2 2.5 2
3 4 3
4 1 1
4 3 3
How can i do it in R, using any of available libraries.