title: Extract Characters/String before Space from a factor data type column
body: <p>I have a R data frame in which one column has factor data type with all text in that column. I want to extract string from that column considering text before space. I tried <code>gsub( " .*$", "", data[, 3] )</code>,where summary is my that field.But it is not working.
  For example: My data is like <code>"abcd efgh ijk" &amp; I want "abcd"</code>
   I tried to convert my factor field as a character field using</p>
  
  <pre><code>data[, 3] &lt;- sapply(data[, 3], as.character)
  </code></pre>
  
  <p>But it's failed to retrieve the string before first space. Can you please help?</p>
  
  <p>Sorry I can't able to put data here as it is a client data</p>