Hello, I am not very familiar with regular expressions and escaping. I 
need to replace the %-signs in a character vector with elements as 
"income 0%-33%# to be replaced by "income 0\%-33\%" (for later use in 
LaTeX). Using

gsub("%","\\%","income 0%-33%")

does not give the desired result. However, gsub("%","\\\\%","income 
0%-33%") gives "income 0\\%-33\\%", one backslash too much. What is the 
appropriate expression to get the desired output (one backslash before 
each %-sign)?

I am using R 2.1.0 on suse linux 9.2.

Thanks, Ruud

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to