title: create long list of variables based on existing variables
body: <p>I have a long list of variables and for each I want to create a dummy variable. I am using the below dplyr mutate code to do this, but know that something like an array in SAS could be used (so I don't have to copy this line out multiple times). I just haven't been able to find an answer on Stack or anywhere else that fits.</p>
  
  <pre><code>Grade_Dist2 &lt;- Grade_Dist2 %&gt;% mutate(
     ACCT2301_FA15_z = ifelse(ACCT2301_FA15 %in% c("A", "B", "C"), 1, 
         ifelse(ACCT2301_FA15 %in% c("D", "F", "W", "Q"), 0, NA)))
  </code></pre>
  
  <p>The columns/vars are arranged together--all vars in the table are similar except an ID var.</p>