Re: [R] Removing values from a string

2012-07-20 Thread arun
   auto insurance 4    insurance 5   auto insurance 6 A.K. - Original Message - From: Abraham Mathew To: r-help@r-project.org Cc: Sent: Thursday, July 19, 2012 3:21 PM Subject: [R] Removing values from a string So I have the following data frame and I want

Re: [R] Removing values from a string

2012-07-19 Thread arun
---- From: Abraham Mathew To: r-help@r-project.org Cc: Sent: Thursday, July 19, 2012 3:21 PM Subject: [R] Removing values from a string So I have the following data frame and I want to know how I can remove all "NA" values from each string, and also remove all "|" values from

Re: [R] Removing values from a string

2012-07-19 Thread Sarah Goslee
There are a couple of ambiguities in your request, but this should get you started: > one$keyword <- gsub("NA\\|", "", one$keyword) > one$keyword <- gsub("^\\|", "", one$keyword) > one keyword 1 auto 2 auto|insurance|quote 3 auto|insurance 4insurance

[R] Removing values from a string

2012-07-19 Thread Abraham Mathew
So I have the following data frame and I want to know how I can remove all "NA" values from each string, and also remove all "|" values from the START of the string. So they should something like "auto|insurance" or "auto|insurance|quote" one = data.frame(keyword=c("|auto", "NA|auto|insurance|quot