I have the following data.frame and would like to change the order of the rows in such a way that rows with variable == "C" come at the top followed by rows with "A" and then those with "B".
library(tidyverse)
set.seed(123)
D1 <- data.frame(Serial = 1:10, A= runif(10,1,5),
                 B = runif(10,3,6),
                 C = runif(10,2,5)) %>% 
     pivot_longer(-Serial, names_to = "variables", values_to = "Value" ) %>% 
  arrange(-desc(variables))
 
     
    