title: For-Loop indexing issue in R
body: <p>I have 28 groups of 48 rows in an R dataframe. I'm trying to take the standard deviation of each group. I used the following statement in R Studio:</p>
  
  <pre><code>stddev &lt;- vector();
  for (i in 1:28) { stddev[i] &lt;- sd(in.subj[((i * 48) -47):(i * 48), 5]); }
  </code></pre>
  
  <p>When I check the values of stddev[] afterward, stddev[1] = NA. Likewise, when I check the standard deviations of individual groups, like sd(in.subj[49:96,5]) I get different values than the for loop printed out.</p>
  
  <p>What would be the cause of these issues?
  Thanks!</p>