comment presumes insight into the psychology of
"surprise" that I don't have).
-- Bert
-Original Message-
From: macra...@gmail.com [mailto:macra...@gmail.com] On Behalf Of Stavros
Macrakis
Sent: Tuesday, February 24, 2009 2:12 PM
To: Peterko
Cc: Bert Gunter; r-help@r-project.or
On Tue, Feb 24, 2009 at 3:01 PM, Bert Gunter wrote:
> 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 yo
enentech
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Peterko
Sent: Tuesday, February 24, 2009 11:55 AM
To: r-help@r-project.org
Subject: Re: [R] bigest part of vector
Thanks for all
Peterko wrote:
>
> Hi, may be simle question
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.nabb
There's probably something built in to R but you can change the values
of the percentiles (p) below to get the value that corresponds to it.
rounding might be problematic also.
temp <- c(1,4,8,3,5)
p <- 0.8
temp[order(temp)][round(length(temp)*p)]
On Tue, Feb 24, 2009 at 2:36 PM, Peterko
Dear Peter,
Perhaps:
set.seed(1) # For reproducibility
p<-2 # Two biggest values of x
x<-rnorm(10)
tail(sort(x),p)
[1] 0.7383247 1.5952808
In a function mode,
foo<-function(x,p=2) tail(sort(x),p)
foo(x,p=3)
[1] 0.5757814 0.7383247 1.5952808
HTH,
Jorge
On Tue, Feb 24, 2009 at 2:36
On Tue, 24 Feb 2009 11:36:06 -0800 (PST) (SO, 55 Chs 3175 YOLD)
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
How
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-tp22188901p22188901
8 matches
Mail list logo