I am trying to resolve a simple problem but I did not find a solution.
I have a data.frame
ordered like this
ID Description value
Gut-1877 T4_2 574
Gut-1896 T5_2 576
Gut-1466 Donor 544
Gut-1734 T1_2 354
Gut-1720 T0_2 185
Gut-1741 T2_2 173
Gut-1748 T3_2 196
Gut-2431A T7_2 421
Gut-2125 T6_2 352
Gut-1656 T1_1 258
Gut-1619 T0_1 77
Gut-1323 Relative 351
I want to put this file in another order and I've tried doing this:
data %>% arrange(value) %>%
mutate(name = factor(Description, levels=c( "Relative","Donor","T0_1","T1_1","T0_2","T1_2","T2_2","T3_2","T4_2","T5_2","T6_2","T7_2")))
But then it did not respect my order as I get:
ID Description value
Gut-1877 T4_2 574
Gut-1896 T5_2 576
Gut-1466 Donor 544
Gut-1734 T1_2 354
Gut-1720 T0_2 185
Gut-1741 T2_2 173
Gut-1748 T3_2 196
Gut-2431A T7_2 421
Gut-2125 T6_2 352
Gut-1656 T1_1 258
Gut-1619 T0_1 77
Gut-1323 Relative 351
How can I put it in the order that I would like thus:
"Relative","Donor","T0_1","T1_1","T0_2","T1_2","T2_2","T3_2","T4_2","T5_2","T6_2","T7_2"
And then how do I plot their values following this order? Thanks a lot to everyone will help.