title: Extracting numbers that include comma from a string, and convert it into numeric array
body: <p>I am trying to extract numbers from a sentence, and then put the numbers together as a numeric array. For example,</p>
  
  <pre><code>  string&lt;-"  The Team:  $74,810 TOTAL RAISED SO FARJOIN THE TEAM Vik Muniz 
               Amount Raised: $70,560   71% Raised of $100,000 Goal CDI International,
               Inc.  Amount Raised: $2,070  Robert Goodwin Amount Raised: $1,500 
               30% Raised of $5,000 Goal Marcel Fukayama Amount Raised: 
               $210  Maitê Proença Amount Raised: $140  
               Thiago Nascimento Amount Raised: $120  
               Lydia Kroeger Amount Raised: $80  "          
  </code></pre>
  
  <p>in order to proceed, I first removed the comma so that I can extract numbers easily:</p>
  
  <pre><code>    string.nocomma &lt;- gsub(',', '', string)
  </code></pre>
  
  <p>and then I tried to put the numbers together as a numeric vector:</p>
  
  <pre><code>    fund.numbers &lt;-unique(as.numeric(gsub("[^0-9]"," ",string.nocomma),""))       
  </code></pre>
  
  <p>and here are the problems:</p>
  
  <ol>
  <li><p>R is throwing an error after the last command. The error is as follow:</p>
  
  <pre><code>Warning message:
  In unique(as.numeric(gsub("[^0-9]", " ", website.fund.nocomma),  :
  NAs introduced by coercion
  </code></pre></li>
  <li><p>Even if I fix the above error and have the numeric vector, I am not sure how to convert numeric vector into an numeric array.</p>
  
  <p>Can someone help me?
  Thanks,</p></li>
  </ol>