title: Adding labels to cut function in R
body: <p>For an example dataframe:</p>
  
  <pre><code>df1 &lt;- structure(list(X = 1:15, a = c(2L, 3L, 4L, 3L, 7L, 5L, NA, 2L, 
  9L, 7L, 0L, 1L, 20L, 15L, 14L)), .Names = c("X", "a"), 
     class = "data.frame", row.names = c(NA, 
  -15L))
  </code></pre>
  
  <p>I am using the following code to divide column 'a' into quartiles:</p>
  
  <pre><code>cut.at.n.tile &lt;- function(X , n = 4){ 
    cut( X , breaks = quantile( X , 
       probs = (0:n)/n , na.rm = TRUE ) , include.lowest = TRUE )}
  df1$a.quartile &lt;- cut.at.n.tile( df1$a , n = 4)
  </code></pre>
  
  <p>How do I replace the labels with 1 - 4 (1 being the lowest)?  I don't wish to simply recode the values as I will be running this lots of times with different continuous variables.</p>
  
  <p>Any help would be greatly appreciated.</p>