This is hopefully a simple question.  I am trying to escape single
quotes like so:

abc's   >> abc\'s

However, I cannot find an easy way to do that with gsub:

gsub("'","\\\\'","abc's")
# returns "abc\\'s"

How can I get a single \ in the output?

Thanks,
Sean

______________________________________________
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