I have a string like a <- "abc'def" and I need to paste this into a longer sql string:
 s <- paste0("select * from x where xx ='", a, "'")
But the single quote in the middle makes it fail, I cannot manually replace ' with \' but need to use a function. 
 
     
    