I have a data frame where the first column represents time and the successive columns ( all 49 of them T-T) hold values at those points in time. I'm trying to define time points t1 and t2 to take averages over within each column, and then arrange those averages in a vector to be able to do vector math with it. In other words the vector that I'm trying to make would have the average of the values from column 2 (remember column 1 is time) over t1 and t2, followed by the average of the values from t1 to t2 of column 3, followed by the average of the values from t1 to t2 of column 4, etc. Finally, I need to make multiple vectors (A,B, and C) for different time points, so for example maybe vector A has the averages from each column over t1 and t2, but B would have the averages from each column over t3 and t4.
I'm completely lost and largely a total noob when it comes to programming so I hope this makes sense. Any advice is appreciated! Thanks so much :)
Not sure if this counts as a reproducible example, but in essence, I have a table like:
t | col1 | col2 | col3 | col4 |
---|---|---|---|---|
1 | 1.1 | 2.1 | 3.1 | 4.1 |
2 | 1.2 | 2.2 | 3.2 | 4.2 |
3 | 1.3 | 2.3 | 3.3 | 4.3 |
4 | 1.4 | 2.4 | 3.4 | 4.4 |
5 | 1.5 | 2.5 | 3.5 | 4.5 |
and I want to define time points like: t1 = 1 and t2 = 3 so that I can take the average over those points from each column, so that the resulting vector would be of the form:
| 1.2 | 2.2 | 3.2 | 4.2 |
where each entry comes from (1.1+1.2+1.3)/3 , (2.1+2.2+2.3)/3, etc.
Again, super sorry I'm so new to this