title: How to save a filtered subset in R in a new column?
body: <p>I hava a large <code>dataframe</code>, and I want to filter based on some columns (all factors), and save the filtered rows as a new column in the same <code>dataframe</code>. So I don't want to make a subset or delete rows, I want to keep them al in the same <code>dataframe</code>. 
  Example:</p>
  
  <pre><code>## my dataframe: 
  test &lt;- data.frame(name=c("alice", "brandon", "cedric", "dwayne"), mark = c("V", "R", "R", "R"), test3 = c("yes", "no", "yes", "no"))
  
  ## the filter I use for selecting
  test %&gt;% filter(mark == "R" &amp; test3 == "no")
  
  ## what I want as added new column (filtered selection)
  test$conclusion &lt;- c(NA, "yes", NA, "yes")
  tets$conclusion &lt;- c(0,1,0,1) # would also be fine. 
  </code></pre>
  
  <p>But I don't know how to do this, except for making an new <code>dataframe</code> from the filtered results, add a new column, and merge the new <code>dataframe</code> with the old <code>dataframe</code>. There must be an easier solution. I tried mutate, but I can only calculate a new column with that function. I tried</p>
  
  <pre><code>test %&gt;% filter(mark == "R" &amp; test3 == "no") %&gt;%
    dplyr::mutate(.$conclusion == "yes")
  </code></pre>
  
  <p>But then I get this error: </p>
  
  <blockquote>
    <p>Error in mutate_impl(.data, dots) : Column `.$conclusion == "yes"` must be length 4 (the number of rows) or one, not 0. </p>
  </blockquote>
  
  <p>Thank you for your help and suggestions.</p>