I am trying to sort a data frame by codes contained in one column.
The logic behind these code is:
S/number/number/number/digit (e.g. S120B). The numbers are not always 3 (e.g. S10K) and the letters are not always present (e.g. S2).
The first code is S1, and the list goes until S999, where it turns to S1A. Then it goes to S999A and then turns to S1B, and so on.
Furthermore, there are also codes inside thare are totally different, as W23, E100, etc that should go together.
How can I order the dataframe according to this pretty sick ordering scheme?
MWE: codes <- c(S1, S20D, S550C, S88A, S420K, E44, W22)