Hi suppose I have a table like this. What I want is rank by "percent" however I only want it based on when the cat column is "HIGH" group and ignore the "LOW".
name cat Freq percent
1 berry HIGH 259 0.583
2 jack HIGH 45 0.634
3 steve HIGH 331 0.943
4 nadia HIGH 304 0.580
5 jacob HIGH 179 0.844
6 susan HIGH 15 0.833
7 luthered HIGH 14 0.264
8 jane HIGH 99 0.513
9 berry LOW 185 0.417
10 jack LOW 26 0.366
11 steve LOW 20 0.057
12 nadia LOW 220 0.420
13 jacob LOW 33 0.156
14 susan LOW 3 0.167
15 luthered LOW 39 0.736
16 jane LOW 94 0.487
I tried doing this but I can't seem to get the condition to work.
temp = structure(list(name = c("berry", "jack", "steve", "nadia", "jacob",
"susan", "luthered", "jane", "berry", "jack", "steve", "nadia",
"jacob", "susan", "luthered", "jane"), cat = c("HIGH", "HIGH",
"HIGH", "HIGH", "HIGH", "HIGH", "HIGH", "HIGH", "LOW", "LOW",
"LOW", "LOW", "LOW", "LOW", "LOW", "LOW"), Freq = c(259L, 45L,
331L, 304L, 179L, 15L, 14L, 99L, 185L, 26L, 20L, 220L, 33L, 3L,
39L, 94L), percent = c(0.583, 0.634, 0.943, 0.58, 0.844, 0.833,
0.264, 0.513, 0.417, 0.366, 0.057, 0.42, 0.156, 0.167, 0.736,
0.487)), class = "data.frame", row.names = c(NA, -16L))
I tried doing this but the order is not correct.
temp %>% arrange(desc ( percent), cat =="HIGH" )
if this is correctly ordered the name should be ordered as such: steve jacob susan jack berry nadia jane luthered
thanks in advance.