-1

Is it possible to bin a variable in to quintile (1/5th) using R. And select only the variables that fall in the 5th bin.

  • As of now I am using the closest option which is quartile (.75) as there is not a function to do quintile.

Any suggestions please.

I Phoenix
  • 49
  • 1
  • 1
  • 9

1 Answers1

4

Not completely sure what you mean, but this divides a dataset into 5 equal groups based on value and subsequently selects the fifth group

obs = rnorm(100)
qq = quantile(obs, probs = seq(0, 1, .2))
obs[obs >= qq[5]]
Vandenman
  • 3,046
  • 20
  • 33