I have it working now, I think. Since it's going into a regular
expression, I have to escape each of the escape characters, resulting
in four backslashes altogether:
> sub("[.]", "x", "a.b")
[1] "axb"
> sub("[.]", "\.", "a.b")
[1] "a.b"
> sub("[.]", "\\.", "a.b")
[1] "a.b"
> sub("[.]", "\\\.", "a.b")
[1] "a.b"
> sub("[.]", "\\\\.", "a.b")
[1] "a\\.b"
> cat(sub("[.]", "\\\\.", "a.b"))
a\.b>
or
> cat(sub("\\.", "\\\\.", "a.b"))
a\.b>
Dan
______________________________________________
[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