title: How sort values inside the list()?
body: <p>I have a list</p>
  <pre><code>list(`groupA_2024-02-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2024-02-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2022-04-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2022-04-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2021-09-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2021-09-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2024-04-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2024-04-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2023-02-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2023-02-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;))
  </code></pre>
  <p>Names have two part 1)before _ and 2) after _ . Before shows to which group (A or B) it corresponds to and second part shows the date. I want to sort this list in the following way 1)Group,2)Date. The necessary output is following:</p>
  <pre><code>list(`groupA_2021-09-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2021-09-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;),
       `groupA_2022-04-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2022-04-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2023-02-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2023-02-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;),
       `groupA_2024-02-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2024-02-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;), 
       `groupA_2024-04-01` = structure(list(name = &quot;groupA&quot;), class = &quot;colDef&quot;), 
       `groupB_2024-04-01` = structure(list(name = &quot;groupB&quot;), class = &quot;colDef&quot;) 
  )
  </code></pre>
  <p>I tried it with simply order function, however, here should be something complicated.</p>