I have a set of measurements in a data frame which I need to add in n number of rows of "NA" at every nth row. The reason is that I have a set of measurements that were taken only at every nth period of time and I will like to plot it to reflect the actual total time.
Hope there is some expert who can help me with this? I have been trying to figure this out for a very long time. Thank you.
For example, for an initial data frame below.
x y
row1 1 2
row2 1 2
row3 1 2
row4 1 2
row5 1 2
row6 1 2
row7 1 2
row8 1 2
row9 1 2
row10 1 2
Suppose I want to add 2 "NA" rows at every other 2 rows:
x y
row1 1 2
row2 1 2
row3 NA NA
row4 NA NA
row5 1 2
row6 1 2
row7 NA NA
row8 NA NA
row9 1 2
row10 1 2
row11 NA NA
row12 NA NA
row13 1 2
row14 1 2
row15 NA NA
row16 NA NA
row17 1 2
row18 1 2