I have a column of ID data (class factor) in the following format: 01-001 etc.
I'd like to extract the first two digits (01) and create a separate column using these digits, ensuring they are numeric.
I did this a few years ago but can't find my old code. Any help would be much appreciated.