I have a data frame (in R) that needs to be sorted out by parts of the sample name to do analysis. For example, each sample is coded in this format in a column titled "Sample": 1.4.a.2021 1 is the week 4 is the device number a is the sampling period in the week and 2021 is the year. I want to sort by the "4" (numbers range from 1-12). Can I sort by a particular character in a string--if that is what this is?