How can I loop through a determinated range of rows? : <p>I am stuck with the beginning of my analysis. Perhaps the question could be stupid, but I would like to request your help for some tips. 
I have a dataframe with several variables; and each variable has 10 observations. My doubt is how can I estimate for each variable the max of the first 5 observations, and the max of the following 5 observations. </p>

<p>This is an example of my code:</p>

<pre><code>    for (i in 1:length(ncols)){
 max.value &lt;- max(var1)
}
</code></pre>

<p>Thank you very much in advance </p>
