R :Looping through each 5 rows of data frame and imputing incremental value

r loop through dataframe rows
r loop through dataframe columns
r loop through list of variables
for loop in r
store for loop values in array r
while loop in r
nested for loop in r
r for loop store results