Add single quotes to a string

concatenation, r, single-quotes, string

Solution

Just use `paste`:

R> paste("'", "ABC", "'", sep="")
[1] "'ABC'"

or the new variety

R> paste0("'", "ABC", "'")
[1] "'ABC'"

Problem

I try to add single quotes to a string but don't see how to do it. For instance I would like to replace ABC by 'ABC'. I have played with `paste`, `cat`, `print` but don't see how to do it. Any solution? Thanks, Vincent

Original source