0

I have a data frame in which one of the columns contains comma separated text strings (attached snapshot). I want to delete all the text within the parentheses (including the parentheses itself).

I have read through the regex but I an not able to get a clear idea to do so. I small hint shall help me to begin understand how regex can be used in R. Any resources one would like to point me towards for R?

Attached snapshot

Can anybody direct me towards any post that discusses it? Apparently, somebody decided to mark my questin as duplicate without telling which is the 'original' post.

Sinha
  • 431
  • 1
  • 5
  • 12
  • Hard to tell if you don't provide a reproducible example. Maybe you can try `gsub("\\s*\\([^\\)]*\\)\\s*","",x)` where `x` is the `character` vector containing the strings you want to modify. – nicola Nov 20 '16 at 22:43
  • Hi Nicola, Basically I want a entry such as **computer(laptop, mouse), chair** to become **computer, chair** . In summary, I want the text within the parentheses to be deleted along with the parentheses itself. – Sinha Nov 20 '16 at 23:32

0 Answers0