I am very much a newbie in R. I am sorry for my naive question.
Part of my data is as follows:
POS Obs_FCT
4345 0.10049191
4484 0.08930793
4515 -0.00468725
4547 -0.00749802
4628 0.01143598
5347 0.05673895
6071 0.01143598
6449 -0.00070778
6498 -0.0109962
7320 0.00543984
7457 -0.00206247
7761 0.08018589
7875 -0.00601304
7988 -0.00070778
9459 0.01447144
9483 0.08269899
9495 -0.03353229
9552 -0.00206247
9602 -0.0269909
9701 -0.00206247
11809 -0.01952417
12593 -0.02173826
16787 0.08930793
17049 -0.06738125
17058 0.01325792
I want to plot Obs_FCT (which is the Y-axis) VS POS (the X-axis), but it is not plotting at all. I also want to apply a sliding window on the POS column. The window is as follows (i.e. that the window size is 1000 and sliding by 200):
1--1000
200 ---1200
400 ---1400
600 ----1600
--------
If the numbers in the POS column are located in each window, compute the mean value of Obs_FCT. (The X axis uses the midpoint of the window).
Could someone please tell me how to use R code to achieve this? Generally I know that maybe I can get what I want through rollapply. But it seems like a function is needed.
[r] rollapplyin the search window above, you get a number of previous discussions. Please see if they address your question. - Dirk Eddelbuettelrunmean()of packagecaToolsalso - Ali