[R] Applying a certain formula to a repeated sample data
Ogbos Okike
giftedlife2014 @ending from gm@il@com
Wed Nov 28 04:05:46 CET 2018
Dear List,
I have three data-column data. The data is of the form:
1 8590 12516
2 8641 98143
3 8705 98916
4 8750 89911
5 8685 104835
6 8629 121963
7 8676 77655
1 8577 81081
2 8593 83385
3 8642 112164
4 8708 103684
5 8622 83982
6 8593 75944
7 8600 97036
1 8650 104911
2 8730 114098
3 8731 99421
4 8715 85707
5 8717 81273
6 8739 106462
7 8684 110635
1 8713 105214
2 8771 92456
3 8759 109270
4 8762 99150
5 8730 77306
6 8780 86324
7 8804 90214
1 8797 99894
2 8863 95177
3 8873 95910
4 8827 108511
5 8806 115636
6 8869 85542
7 8854 111018
1 8571 93247
2 8533 85105
3 8553 114725
4 8561 122195
5 8532 100945
6 8560 108552
7 8634 108707
1 8646 117420
2 8633 113823
3 8680 82763
4 8765 121072
5 8756 89835
6 8750 104578
7 8790 88429
I wish to calculate average of the second and third columns based on the
first column for each repeated 7 days. The length of the data is 1442. That
is 206 by 7. So I should arrive at 207 data points for each of the two
columns after calculating the mean of each group 1-7.
I have both tried factor/tapply and aggregate functions but seem not to be
making progress.
Thank you very much for your idea.
Best wishes
Ogbos
[[alternative HTML version deleted]]
More information about the R-help
mailing list