title: Check if two out of 5 consecutive values are larger than x
body: <p>I have a column with values and want to check if the sum of 5 consecutive values (within a certain range - row 259 to row 272) is > 10 and if at least two out of the 5 values are > 3</p>
  
  <p>This is what I used to come up with the sum of 5 consecutive values. It divides my range into twelve blocks and check each block individually.</p>
  
  <pre><code>data &lt;- read.table("....csv", header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)
  interval &lt;- 5
  start &lt;- 259
  end &lt;- 272
  block&lt;-sapply(start:(end-interval+1),function(x){sum(data[x:(x+interval-1)])})
  </code></pre>
  
  <p>Now I check if the value of the block is > 10</p>
  
  <pre><code>if ( block [[1]]&gt; 10 ) {
    print(paste("block to fulfill the condition is block", 1))
  } else if ( block [[2]]&gt; 10 ) {
    print(paste("block to fulfill the condition is block", 2))
  ....
  </code></pre>
  
  <p>How can I include the condition "two out of 5 values from a block have to be > 3" into my if-clause? </p>