title: 'x' must be an array of at least two dimension
body: <p>I have a dataframe with 20 variables and 20000 observations. I first convert this into all boolean values to indicate whether each original value is above some threshold (here, the threshold is <code>&gt;=1</code>). </p>
  
  <p>Each set of 10 variables makes up a group. I want to filter the data to remove any row that has 5 or more above-threshold values for any group. How can I do that? </p>
  
  <p>I tried following, but the second line produces an error message: </p>
  
  <pre><code>MyData_filter &lt;- as.matrix(MyData[1:20] &gt;= 1)
  keeps &lt;- apply(MyData_filter, 1,function(x) {! any(rowSums(x[1:10])&gt;=5) &amp;&amp; any(rowSums(x[11:20])&gt;=5) })
  MyData_Filtered&lt;- MyData_filter[keeps, ]
  </code></pre>
  
  <pre><code>Error in rowSums(MyData_filter[1:10]) : 
    'x' must be an array of at least two dimensions
  </code></pre>