Skip to content
Prev 177901 / 398502 Next

paste(" /" ") and paste(" /' ")

Agustin Lobo wrote:
paste() doesn't write anything, it constructs character vectors.  It is 
the auto-printing that is adding the backslashes.  Use cat() to write 
things without them:

 > cat(paste("\"","Hola","\"",sep=""))
"Hola"

In fact, cat() is flexible and you could just use

cat("\"","Hola","\"",sep="")
print() puts double quotes around strings when it prints them; that 
means it needs backslash escapes on double quotes within the string, but 
single quotes are fine.
Your vector did contain "Hola", but print() escaped the quotes.

Duncan Murdoch