[R] bigest part of vector

Bert Gunter gunter.berton at gene.com
Tue Feb 24 21:01:37 CET 2009


Nothing wrong with prior suggestions, but strictly speaking, (fully) sorting
the vector is unnecessary.

y[y > quantile(y, 1- p/length(y))]

will do it without the (complete) sort. (But sorting is so efficient anyway,
I don't think you could notice any difference).

-- Bert Gunter
Genentech 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Peterko
Sent: Tuesday, February 24, 2009 11:55 AM
To: r-help at r-project.org
Subject: Re: [R] bigest part of vector


Thanks for all

Peterko wrote:
> 
> Hi, may be simle question, but a do not find it anywhere.
> Is there same function like max()  ,but giving more results.
> max() give 1number-maximum
> I need funcion what give p bigest number.
> many thanks
> 

-- 
View this message in context:
http://www.nabble.com/bigest-part-of-vector-tp22188901p22189283.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
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.




More information about the R-help mailing list