title: Converting internationally formatted strings to numeric
body: <p>I have a file with internationally formatted numbers (i.e strings) including units of measurement. In this case the decimal place is indicated by "," and the 1e3 seperator is indicated as "." (i.e. German number formats).</p>
  
  <pre><code>a &lt;- c('2.200.222   €',
         '  180.109,3 €')
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>b &lt;- c('28,42 m²',
         '47,70 m²')
  </code></pre>
  
  <p>I'd like to convert these strings efficiently to <code>numeric</code>. I've tried to filter out numbers by codes like</p>
  
  <pre><code>require(stringr)
  str_extract(a, pattern='[0-9]+.[0-9]+.[0-9]+')
  str_extract(b, pattern='[0-9]+,[0-9]+')
  </code></pre>
  
  <p>however, this does seem to be too prone to errors and I guess there must be a more standardized way. So here's my question: Is there a custom function, package or something else that is capable of such a problem?</p>
  
  <p>Thank you very much!</p>