Re: [R] replace parenthetical phrases in a string

2012-12-13 Thread arun
-- Original Message - From: "Adams, Jean" To: r-help@r-project.org Cc: Sent: Thursday, December 13, 2012 6:03 PM Subject: Re: [R] replace parenthetical phrases in a string My apologies.  I sent too soon! I did a bit more digging, and found a solution on the R-help archives. y &l

Re: [R] replace parenthetical phrases in a string

2012-12-13 Thread Adams, Jean
My apologies. I sent too soon! I did a bit more digging, and found a solution on the R-help archives. y <- gsub(" *\\([^)]*\\) *", "", x) Jean On Thu, Dec 13, 2012 at 4:53 PM, Adams, Jean wrote: > R-helpers, > > I have a vector of character strings in which I would like to replace each > p

[R] replace parenthetical phrases in a string

2012-12-13 Thread Adams, Jean
R-helpers, I have a vector of character strings in which I would like to replace each parenthetical phrase with a single space, " ". For example if I start with x, I would like to end up with y. x <- c("My toast=bog(keep=3 no=4) and eggs(er34)omit=32", "dogs have ears", "cats have tails (and ear