Re: [R] Placeholders for String Operations

2013-09-04 Thread Sarah Goslee
Hi Simon, What you need are regular expressions. The help for gsub says this, but in such a way that if you didn't know that's what you were looking for, you wouldn't learn it there: See the help pages on regular expression for details of the different types of regular expressions. Th

Re: [R] Placeholders for String Operations

2013-09-04 Thread Rui Barradas
Hello, I'm not sure I understand, but if you want a ?regexp to only match numbers before a %, try the following. gsub("[0-9]+%", "[percentagevalue]", text1) gsub("[0-9]+%", "[percentagevalue]", text2) [0-9] matches any character in the range from 0 to 9, and the + means to repeat that char

Re: [R] Placeholders for String Operations

2013-09-04 Thread arun
Hi,  gsub("#%", "[percentagevalue]", text1) #[1] "this is a number 23%"  gsub("\\d+%$", "[percentagevalue]", text1) #[1] "this is a number [percentagevalue]"  gsub("bla", "23", text2) #[1] "this is not a number 23%" A.K. - Original Message - From: Simon Pickert To: r-help@r-proje