This is similar to this: Arranging rows in custom order using dplyr But I am looking for different results...
v1 <- rep(LETTERS[1:3], each = 2)
v2 <- rep(c("Seg1", "Seg2"), times = 3)
v3<- c(300,200,500,700,600,550)
df<- data.frame(v1,v2,v3)
so that's my original df and we see the order A,A,B,B,C,C I want to change the order so it will be C,A,B,C,A,B I tried using
df %>%
arrange(match(v1, c("C", "A", "B")), desc(v2), desc(v3))
but this gives us a result that looks like C,C,A,A,B,B
original df:
results I want:
unwanted result I get: