title: Replacing original variable using parse_number and mutate in dplyr
body: <p>I have some data that contains a set of variables that have a mix of numbers and characters, such as &quot;1 - Completely Disagree.&quot; I would like to remove the characters and keep only the numbers, but retain the variables within the original dataset under their original name. So, I have a variable called &quot;systematic1&quot; with the value &quot;1 - Completely Disagree. I would like it to become just &quot;1&quot; in numeric form within the original dataset. This what I have:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>systematic1</th>
  <th>systematic2</th>
  <th>systematic3</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1 - Completely Disagree</td>
  <td>7 - Completely Agree</td>
  <td>7 - Completely Disagree</td>
  </tr>
  <tr>
  <td>5 - Somewhat Agree</td>
  <td>4 - Neither Agree nor Disagree</td>
  <td>6 - Agree</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>This is the desired output:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>systematic1</th>
  <th>systematic2</th>
  <th>systematic3</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>7</td>
  <td>7</td>
  </tr>
  <tr>
  <td>5</td>
  <td>4</td>
  <td>6</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I've been able to mostly accomplish this using the following code:</p>
  <pre><code>data %&gt;%
     select(systematic1:withdrawn) %&gt;% #select range 
     select_if(is.character) %&gt;% #keep only character vars
     mutate_all(~parse_number(.,na=c(&quot;Not sure&quot;))) #parse out number, treating &quot;Not sure&quot; as NA
  </code></pre>
  <p>But that produces a new dataframe with those transformed variables. I would like to keep the variables in the original dataset, only transformed.</p>