Re: [R] Removing values from a string

2012-07-20 Thread arun
insurance 6 A.K. - Original Message - From: Abraham Mathew abmathe...@gmail.com 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

[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|quote,

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 5

Re: [R] Removing values from a string

2012-07-19 Thread arun
] 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 the START of the string. So they should something like auto|insurance or auto|insurance|quote one = data.frame(keyword=c(|auto, NA