Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

order key values of list of dataframe in R

I have a list of table such as

The_list

$df1

    col1  col2
1   M     P
2   N     Q
3   O     R

$df2

    col1  col2
1   G     J
2   H     K
3   I     L

$df3

    col1  col2
1   A     D
2   B     E
3   C     F

How could I sort the key value of The_list in that order <- c("df2","df3","df1")

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

and then get :

The_list

$df2

    col1  col2
1   G     J
2   H     K
3   I     L

$df3

    col1  col2
1   A     D
2   B     E
3   C     F


$df1

    col1  col2
1   M     P
2   N     Q
3   O     R

So far I tried:

The_list[order(c("df2","df3","df1"))]

>Solution :

The_list[c("df2","df3","df1")]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading