title: split packaging strings using R
body: <p>I'm working with some packaging strings and am in need of calculating their conversions to "each".</p>
  
  <p>They look something like this: </p>
  
  <pre><code>     packing                          uom   
  [1,] "100EA/BX 1000EA/CA"             "BX"
  [2,] "100EA/CA"                       "CA"
  [3,] "10EA/BX 4BX/CA"                 "EA" 
  [4,] "1EA/EA"                         "BX" 
  [5,] "1EA/EA 12EA/BG 12EA/DZ 94EA/CA" "BG" 
  </code></pre>
  
  <p>The number of small segments range from 1 to 4. I have tried to split the cells to extract the numbers and units of measure, and then wrote a very long script with plenty of conditional statements to make the calculation. I'm wondering if there are easier ways to accomplish this task. Below is the desired output. Thanks!</p>
  
  <pre><code>     packing                          uom  conv 
  [1,] "100EA/BX 1000EA/CA"             "BX" "100"
  [2,] "100EA/CA"                       "CA" "100"
  [3,] "10EA/BX 4BX/CA"                 "EA" "1"  
  [4,] "1EA/EA"                         "BX" "1"  
  [5,] "1EA/EA 12EA/BG 12EA/DZ 94EA/CA" "BG" "12" 
  </code></pre>