title: Assigning individuals to an income quantile
body: <p>I have a set of data such as the following:</p>
  
  <pre><code>annual_exp&lt;-as.data.frame(c(6000,4200,240001,750,20000,3470,10500,2400,2280,36000,3600,20000,2000,12000,1200,3000,4500,64000))
  annual_exp&lt;-as.data.frame(annual_exp)
  </code></pre>
  
  <p>I want to create a new variable, call it "quintile", which assigns each observation an integer between 1 and 5, inclusive, depending on which quintile of income expenditure (annual_exp) they fall into. So there should be an equal number of 1`s through to 5.</p>
  
  <p>My attempt so far has been to do the following:</p>
  
  <pre><code>test&lt;-quantile(annual_exp$annual_exp, probs= seq(0,1,0.2), na.rm=TRUE)
  summary(test)
  test
  
  breaks&lt;-c(test[1],test[2],test[3],test[4],test[5],test[6])
  quantiles&lt;-cut(annual_exp$annual_exp, breaks, labels=c("1","2","3","4","5"), include.lowest=TRUE, right=TRUE)
  quantiles&lt;-as.data.frame(quantiles)
  quantiles&lt;-cbind(annual_exp, quantiles)
  </code></pre>
  
  <p>The problem (which doesn`t really show with such a small sample as created in this example), is that the number of people falling into each quantile by doing this varies wildly. This is because I have used the function "quantile" above.</p>
  
  <p>As such, I am looking for an alternative to the "quantile" part of the equation, which will split the sample up into 5 equal groups of quintiles based on their annual expenditure.</p>
  
  <p>Any help on this would be very appreciated!</p>