title: How to organize based on specific data values
body: <p>I have this data frame:</p>
  <pre><code>structure(list(ID = c(101, 102, 103, 104, 105, 106
  ), 1Var = c(1, 3, 3, 1, 1, 1), 2Var = c(1, 1, 
  1, 1, 1, 1), 3Var = c(3, 1, 1, 1, 1, 1), 4Var = c(1, 
  1, 1, 1, 1, 1)), row.names = c(NA, 6L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>I have been trying to subset based on values of 1 and 0. In this data table there are no 0 values but my full data has it.</p>
  <p>I toyed around with this method:</p>
  <pre><code>Prime &lt;- grep('$Var', names(Data))
  DataPrime &lt;- Data[rowSums(Data[Prime] &lt;= 1),]
  </code></pre>
  <p>I am getting duplicated observations though. Another issue with this method is that it keeps all rows that have a 1 or 0 but not rows with ONLY 1 or 0. So, some rows that have 3 but the rest of the variables are value of 1 that row is still kept in my data.</p>
  <p>I think my method will work but I'm not sure what else I need to specify in the argument. I tried a simple subset too but that removed everything from the data:</p>
  <pre><code>DataPrime &lt;- subset(Data, '1Var' &lt;=1, '2Var' &lt;=1, '3Var' &lt;=1, '4Var' &lt;=1)
  </code></pre>
  <p>I essentially want my data to look something like this:</p>
  <pre><code> ID             1Var        2Var        3Var      4Var
  4 104             1          1           1          1
  5 105             1          1           1          1
  6 106             1          1           1          1
  </code></pre>