[R] returning quartiles of a list?

Greg Trafton trafton at itd.nrl.navy.mil
Tue Jul 10 16:44:44 CEST 2001


Hi, all.  I have a list:

process <- c( 5 , 7 , 4 , 1 , 4 , 1)

and I'd like to get each half (or each third or each quartile) of the list:

process.firsthalf would be (5, 7, 4) and 
process.secondhalf would be (1, 4, 1).

note that I'm not interested in the numeric quartiles (then I could
use quantile or several other functions).

what is the best way to get this kind of thing?  for odd legnth lists,
I don't particularly care if the first or the second half gets the
extra.

 can write a function that does this for halfs, but I'm looking for a
slightly more general way that does it for 1/2, 1/3, 1/4, 1/5, etc.

thanks!
greg
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list