title: is `vec` same as `rollapply(vec, width = 1, by = 1, FUN = mean, align = "left")`?
body: <p>I have vector from which I've created subset using this command:</p>
  
  <pre><code>sub.as = as[seq(70,100)]
  </code></pre>
  
  <p>The subset is following:</p>
  
  <pre><code>&gt; is.vector(sub.as)
  [1] TRUE
  
  &gt; str(sub.as)
   num [1:31] 1 0.75 0.9 0.475 0.925 0.975 1 1 0.525 1 ...
  
  &gt; sub.as
   [1] 1.000 0.750 0.900 0.475 0.925 0.975 1.000 1.000 0.525 1.000 0.200 0.200
  [13] 0.200 0.200 0.150 0.150 0.150 0.150 0.150 0.450 0.875 0.175 0.150 0.150
  [25] 0.150 0.100 0.100 0.100 0.100 0.350 1.000
  </code></pre>
  
  <p>I've applied <code>rollapply</code> to this vector following way:</p>
  
  <pre><code>&gt; sub.as.avg.1 = rollapply(sub.as, width = 1,  by = 1,  FUN = mean, align = "left")
  </code></pre>
  
  <p>Based on <a href="https://stackoverflow.com/questions/10374932/comparing-two-vectors-in-an-if-statement">this</a> answer I've compared both vectors. Length of the outputs are the same:</p>
  
  <pre><code>&gt; length(sub.as)
  [1] 31
  
  &gt; length(sub.as.avg.1)
  [1] 31
  </code></pre>
  
  <p>Values on those indexes should be different:</p>
  
  <pre><code>&gt; which(sub.as != sub.as.avg.1)
   [1] 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29
  </code></pre>
  
  <p>Values that should be different (but as you can see they aren't):</p>
  
  <pre><code>&gt; sub.as[which(sub.as != sub.as.avg.1)]
   [1] 0.200 0.200 0.200 0.200 0.150 0.150 0.150 0.150 0.150 0.450 0.175 0.150
  [13] 0.150 0.150 0.100 0.100 0.100 0.100
  
  &gt; sub.as.avg.1[which(sub.as != sub.as.avg.1)]
   [1] 0.200 0.200 0.200 0.200 0.150 0.150 0.150 0.150 0.150 0.450 0.175 0.150
  [13] 0.150 0.150 0.100 0.100 0.100 0.100
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>is <code>vec</code> same as <code>rollapply(vec, width = 1,  by = 1, FUN = mean, align
  = "left")</code>?</li>
  <li>Why <code>which</code> shows that there are differences between vectors?</li>
  </ol>