title: R: mutate over multiple columns to create a new column
body: <p>I'm trying to create a new column based on values of other columns.</p>
  
  <p>Here is a dataset that is similar to what I'm working on. 
  I have three variables, Test1, Test2, Test3. 
  I am trying to create a new variable that is 1 if any of the Test variables are
  either DF60, DF61, DF63 or DF64 or 0 otherwise. </p>
  
  <pre><code>Test1&lt;-c("DF64", "DF63", "DF89", "DF30", "DF70")
  Test2&lt;-c("DF61", "DF25", "DF00", "DF30", "DF99")
  Test3&lt;-c("DF80", "DF63", "DF60", "DF63", "DF70")
  Test&lt;-data.frame(Test1, Test2, Test3)
  </code></pre>
  
  <p>I have many ifelse statements at the moment and am looking for a code that can
  loop over the multiple Test variables while allowing multiple values to be looked up.</p>
  
  <p>After looking through some similar threads, I tried mutate_at but I don't think that is the right way.</p>
  
  <pre><code>Test2&lt;- Test %&gt;%
  mutate_at(vars(starts_with("Test")), funs(Test=ifelse("DF60" | "DF61" | 
  "DF62" | "DF63", 1, 0)))
  </code></pre>
  
  <p>Any help is much appreciated!</p>
  
  <p>Thanks!</p>