title: generating quintiles and recoding multiple variables in R
body: <p>I have 33 columns/variables with different values. What I am trying to do: generate quintiles for all variables (done), then use the quintiles to recode each variable (-2, -1, 0, 1, 2) by quintile, I generated quintiles using: </p>
  
  <pre><code>q &lt;- apply(ndataframe[2:34], 2, quantile, c(.2, .4, .6, .8, 1), na.rm = T)
  </code></pre>
  
  <p>Each variable is on different scale which is why the quintile values differ. I assume there is a better and more efficient way to then recode by quintile than what I have been doing so which is using the quintile values and manually recoding each column one by one, e.g.:</p>
  
  <pre><code>n_df_quins$A_q &lt;- recode(n_dataframe$A
                     "0:1529 = '-2'; 1530:2199 = '-1'; 2200:2999 = '0'; 3000:3999 = '1'; 4000:25000 = '2'")
  </code></pre>
  
  <p>Thanks very much for any assistance anyone can offer.</p>