On Dec 13, 2009, at 1:00 PM, Sean Zhang wrote:

Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash with double
backward slash in a string?

i.e.,  from  "a/b" to "a\\b"

> sub("/", "\\\\","a/b")
#the backslashes need to be doubled because they are the escape character.
[1] "a\\b"


Many thanks in advance.

-Sean

        [[alternative HTML version deleted]]

______________________________________________
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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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.

Reply via email to