title: How do I extract the number from a string vector and convert it to a integer vector?
body: <p>I have a string vector in R as follows:</p>
  
  <pre><code>[1] Type 1 Type 2 Type 4 Type 3 Type 4 Type 6 Type 2 Type 5 
  [9] Type 2 Type 3 Type 7 
  </code></pre>
  
  <p>Also note:</p>
  
  <pre><code>str(data)
  # Factor w/ 7 levels "Type 1","Type 2",..: 1 2 1 3 4 1 2 4 2 3 ...
  </code></pre>
  
  <p>I want to convert this to an integer vector to be able to perform cluster analysis (get cluster performance index). Because I am getting the following error: argument 'part' must be an integer vector</p>
  
  <p>What would be the most effective solution?</p>