title: Why can't I extract only the first word of the fields of a column with loop for in r?
body: <p><br>
  Can anyone help me with this simple task.<br>
  I'm getting started in r, and I can't understand why  this part of code isn't running inside a loop for.<br>
  I've tried to use the function <code>strsplit()</code> out of the loop and it worked well, but I'm not succeding in running the code the way I would like to, inside a for loop, in a data frame. <br></p>
  
  <p>Here is the code: <br></p>
  
  <pre><code>mpg &lt;- ggplot2::mpg
  df_sort &lt;- data.frame(uni_model = sort(unique(mpg$model)))
  df_sort$model1 &lt;- ''
  for (x in seq_along(df_sort$model)){
      df_sort[x, 'model1'] &lt;- strsplit(df_sort[x, 'model'], ' ')    
  }
  </code></pre>