title: Remove parentheses and text within from strings in R
body: <p>In R, I have a list of companies such as:</p>
  
  <pre><code>companies  &lt;-  data.frame(Name=c("Company A Inc (COMPA)","Company B (BEELINE)", "Company C Inc. (Coco)", "Company D Inc.", "Company E"))
  </code></pre>
  
  <p>I want to remove the text with parenthesis, ending up with the following list: </p>
  
  <pre><code>                  Name
  1        Company A Inc 
  2            Company B
  3       Company C Inc.
  4       Company D Inc.
  5            Company E
  </code></pre>
  
  <p>One approach I tried was to split the string and then use ldply:</p>
  
  <pre><code>companies$Name &lt;- as.character(companies$Name)
  c&lt;-strsplit(companies$Name, "\\(")
  ldply(c)
  </code></pre>
  
  <p>But because not all company names have parentheses portions, it fails: </p>
  
  <pre><code>Error in list_to_dataframe(res, attr(.data, "split_labels"), .id, id_as_factor) : 
    Results do not have equal lengths
  </code></pre>
  
  <p>I'm not married to the strsplit solution. Whatever removes that text and the parentheses would be fine. </p>