Below works but it has two backslashes in the word. maybe someone can explain why the 4 and 2 works but 2 1 doesn't ? thanks. gsub("\\\\","","Hello\\World",perl=TRUE)
On Apr 3, 2009, Andrew Conway <agc...@nyu.edu> wrote: I am trying to check for backslashes in data, then remove them when I find them, but am having a difficult time figuring out the best way to do it. I know the backslash is the escape character in R, and I should be able to use 'gsub' to accomplish this, but I all I seem to be getting are errors. For example: If entry is: "Hello\World" I want: "HelloWorld" There are several entries with backslashes, and I need to find them and delete them. All help is welcome, thank you. ___________________________________ Drew Conway Ph.D. Student Department of Politics, New York University [1]agc...@nyu.edu [2]http://homepages.nyu.edu/~agc282 [[alternative HTML version deleted]] ______________________________________________ [3]r-h...@r-project.org mailing list [4]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [5]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. References 1. mailto:agc...@nyu.edu 2. http://homepages.nyu.edu/~agc282 3. mailto:R-help@r-project.org 4. https://stat.ethz.ch/mailman/listinfo/r-help 5. http://www.R-project.org/posting-guide.html ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.