Parse Factor in R : <p>I have a column of ID data (class factor) in the following format: 01-001 etc.</p>

<p>I'd like to extract the first two digits (01) and create a separate column using these digits, ensuring they are numeric.</p>

<p>I did this a few years ago but can't find my old code. Any help would be much appreciated.</p>
