I have a series of binary number sequences as indicator variables. For example this
100000001001
110000000000
100000000011
111000000000
100000000000
100100000110
may be an index for 2 other non-binary variables.
How would I order these in R (or sort them), so that this is returned with the corresponding values it indexes:
100000000000
110000000000
111000000000
crap I'm not interested in
Where “crap I’m not interested in” are the other values that are not the sequences that start with 1, continue with 1, and then have trailing zeros. But what I have are all possible combinations, which I do not need. Any help is appreciated.
Making up a vector for demo purposes (the example given above):
Grab the the interesting values with regexp:
Sort it: