title: Order within and between elements of a list
body: <p>Suppose we have the following list of characters:</p>
  <pre><code>mylist &lt;- list(c(&quot;I312&quot;,&quot;Z432&quot;,&quot;O115&quot;),  
                 c(&quot;S123&quot;),  
                 c(&quot;O978&quot;,&quot;T213&quot;),  
                 c(&quot;T123&quot;))
  
  mylist
  [[1]]
  [1] &quot;I312&quot; &quot;Z432&quot; &quot;O115&quot;
  [[2]]
  [1] &quot;S123&quot;
  [[3]]
  [1] &quot;O978&quot; &quot;T213&quot;
  [[4]]
  [1] &quot;T123&quot;
  </code></pre>
  <p>First I want to order within elements of mylist and then beetween elements of mylist due to the first component. The result should be as:</p>
  <pre><code>[[1]]
  [1] &quot;I312&quot;  &quot;O115&quot;  &quot;Z432&quot;
  [[2]] 
  [1] &quot;O978&quot;  &quot;T213&quot;
  [[3]] 
  [1] &quot;S123&quot;
  [[4]] 
  [1] &quot;T123&quot;
  </code></pre>
  <p>Thanks for any help.</p>