hello,

It's also possible to use the quantile function :

vec0 <- c(0.1,0.2, 0.5, 0.1,0.8, 0.4, 0.9)
which(vec0 >= quantile(vec0, 0.7, type = 1))

SD


2014-03-29 18:02 GMT+01:00 arun <smartpink...@yahoo.com>:

> Hi,
> Try:
> vec1 <- setNames(c(0.1,0.2, 0.5, 0.1,0.8, 0.4, 0.9), 1:7)
> vec2 <- sort(vec1,decreasing=TRUE)
>
> names(vec2[seq(ceiling(length(vec2)*0.3))])
> #[1] "7" "5" "3"
> A.K.
>
> Hi, I need your help again. I have some data like this:
> 1      2        3       4      5        6       7      ...
> 0.1  0.2 0.5     0.1  0.8    0.4     0.9  ... I need to select the 30%
> higgest values,but in the ouitput I need the index (position where is the
> maximum values). In that case the output will be 7,5,3,... for example.
> Thank you
>
>
> ______________________________________________
> 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