I have a vector of characters, for example,
a = c('s1.bmp','s10.bmp','s11.bmp','s2.bmp','s3.bmp','s4.bmp')
This order is what is automatically generated, but I want to sort it into
b = c('s1.bmp','s2.bmp','s3.bmp','s4.bmp','s10.bmp','s11.bmp')
So that the order of the character vector is based on the ascending order of the numeric value inside of the character vector. Is there convenient way to do this?
Aucun commentaire:
Enregistrer un commentaire