I’d like to take numeric data, and calculate numeric “quintiles” with
integer values in from 1 – 5 , with values in the lowest 20% of values
having a value of 1, the >20 - <= 40% of values having a value of 2,
the >40% - <=60% of values having a value of 3, etc.

How can I use quantcut, or another function, to do this?


Thanks!


Ex.

x <- c(1:10)

I want:
myquintilefunction (x, q=5, na.rm=T) to return a vector with values:
1,1,2,2,3,3,4,4,5,5

Thanks!

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to