[R] select maximum values
arun
smartpink111 at yahoo.com
Sat Mar 29 18:02:22 CET 2014
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
More information about the R-help
mailing list