title: converting a string of numbers into numbers in R
body: <p>I have a similar string to below from my shiny app via textAreaInput:
  Basically one can copy paste either numbers or names into the box.</p>
  <p>It can be either seperated by emty space or line break.</p>
  <p>When I read it is similar to the x as an example.</p>
  <pre><code>x &lt;- &quot;35   4.6   6.9         -0.4       -4.4&quot;
  #I can get each charcter with the following:
  b&lt;-stringr::str_split(x, boundary(&quot;word&quot;))[[1]] 
  #but when the input is all numbers as seen in x, the negative signs disappear as below:
  
  stringr::str_split(a, boundary(&quot;word&quot;))[[1]] 
  [1] &quot;35&quot;  &quot;4.6&quot; &quot;6.9&quot; &quot;0.4&quot; &quot;4.4&quot;
  </code></pre>
  <p>Is there a way to make sure I get the negative signs as well?</p>
  <p>The reason I am using boundary(&quot;word&quot;) option is because it allows me to paste either with line break or with any number of spaces among elements.</p>
  <p>Note: the solution should also work if x has only characters like this:</p>
  <pre><code>x &lt;- &quot;name1    name2 name3      name5&quot;
  stringr::str_split(x, boundary(&quot;word&quot;))[[1]]
  [1] &quot;name1&quot; &quot;name2&quot; &quot;name3&quot; &quot;name5&quot;
  </code></pre>