Hi all, I've got object *cumsumtab, *where the first row (1,2,3,4,5,6,8,13,14,17,40) are names (actually, categories), and the second row has numeric values.
> cumsumtab 1 2 3 4 5 6 8 13 14 17 40 2 4 6 7 9 11 13 14 15 16 17 I'm trying to find a way of finding to which category ( in *names(cumsumtab) * ) belongs a given value (let's say Q1 <- 4.25). So far, I've tried the following: > Q1 <- 4.25 >cstQ1 <- cumsumtab-Q1 >cstQ1 1 2 3 4 5 6 8 13 14 17 40 -2.25 -0.25 1.75 2.75 4.75 6.75 8.75 9.75 10.75 11.75 12.75 > min(cstQ1[cstQ1>0]) [1] 1.75 Then I'm trying to recover the name of the class that 1.75 (the closest superior number) belongs to. I haven't found a function that actually tells you the position that the value occupy on the list (so I can slice it or something). ANY idea would be of great help. Thanks in advance. Germán Bonilla I.Ecol, UNAM [[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.