[R] calculating quintile values of numeric data?

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Jan 23 07:59:46 CET 2019


?range
?findInterval

On January 22, 2019 6:54:14 PM PST, Kelly Thompson <kt1572757 using gmail.com> wrote:
>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 using 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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list