Linked Questions

Popular Questions

Arrange data frame reversed order

Asked by At

I have a data frame which I want to order (not alphabetically) so I wrote this

z
  Grupos prueba$pendiente
1     TR         12.48182
2 TR2x45         39.87879
3     UT         20.89545
4 UT2x45         36.89015
orden
[1] "UT"     "TR"     "UT2x45" "TR2x45"
z<-arrange(z,orden)
z
  Grupos prueba$pendiente
1 TR2x45         39.87879
2 UT2x45         36.89015
3     TR         12.48182
4     UT         20.89545

dput(z) structure(list(Grupos = structure(c(4L, 3L, 2L, 1L), .Label = c("UT", "TR", "UT2x45", "TR2x45"), class = "factor"), prueba$pendiente = c(39.8787878787918, 36.8901515151553, 12.4818181818195, 20.8954545454566)), .Names = c("Grupos", "prueba$pendiente"), row.names = c(NA, -4L), class = "data.frame")

Arrange function is working, the only problem is I got the wrong order (reversed) I want UT to be my first value just like in orden vector. I'm sure it's a quite silly thing but I can't work it out.

Thank you

Related Questions