title: Recode multiple columns using dplyr
body: <p>I had a dataframe where I recoded several columns so that 999 was set to NA</p>
  
  <pre><code>dfB &lt;-dfA %&gt;%
    mutate(adhere = if_else(adhere==999, as.numeric(NA), adhere)) %&gt;%
    mutate(engage = if_else(engage==999, as.numeric(NA), engage)) %&gt;%
    mutate(quality = if_else(quality==999, as.numeric(NA), quality)) %&gt;%
    mutate(undrstnd = if_else(undrstnd==999, as.numeric(NA), undrstnd)) %&gt;%
    mutate(sesspart = if_else(sesspart==999, as.numeric(NA), sesspart)) %&gt;%
    mutate(attended = if_else(attended&gt;=9, as.integer(NA), attended))
  </code></pre>
  
  <p>I want to use mutate_at() and a range of columns and recode() instead of if_else(), but I am stuck on how to give it the condition. I think something like  <code>999</code> = NA  based on some mutate_all examples -- but I also need the NA to match the type of .x and I am unsure how to get it to be type sensitive</p>
  
  <p>I tried:</p>
  
  <pre><code>y &lt;- data.frame(y1=c(1,2,999,3,4), y2=c(1L, 2L, 999L, 3L, 4L), y3=c(T,T,F,F,T))
  z &lt;- y %&gt;%
      mutate_at( vars(y1:y2), funs(recode(.,`999` = as.numeric(NA))))
  </code></pre>
  
  <p>But I get a warning "Unreplaced values treated as NA as .x is not compatible. Please specify replacements exhaustively or supply .default " and I can see that it worded for the numeric column, but not for the integer column y2"</p>
  
  <pre><code>&gt; z
    y1 y2    y3
  1  1 NA  TRUE
  2  2 NA  TRUE
  3 NA NA FALSE
  4  3 NA FALSE
  5  4 NA  TRUE
  </code></pre>