I need to change the order of elements in a list
. I don't find a patent response in others questions about sort or order a list.
Here is a simple example.
Freedom <- c(1, 2, 3, 2, 1, 2)
Equality <- c(2, 3, 1, 1, 2, 1)
TypeCountry <- c("South", "East", "East", "North", "South", "West")
Example <- list(Freedom, Equality, TypeCountry)
names(Example) <- c("Freedom", "Equality", "TypeCountry")
The list
has the order Freedom
, Equality
then TypeCountry
and I want to be able to change the order of the elements (for example Equality
, Freedom
then TypeCountry
).
Just do this:
Ex <- Example[c("TypeCountry","Freedom", "Equality")]
You specify the order you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With