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 PM, Peterko <lanikpe...@gmail.com> 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-tp22188901p22188901.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to