1

I want to use the following commands to generate an output like "I want to test\ttab", but the output is "I want to test tab". I want \t to be there rather than being interpreted as a tab delimiter. Is there a way to do this? Can anyone help? Thank you very much in advance!

sink(paste("test","sh",sep="."))
cat(paste0("I want to test","\t","tab"))
cat("\n")
sink()

Thanks, R

1 Answers1

3

Add simply an extra slash to escape the following special character:

cat(paste0("I want to test","\\t","tab"))
cat("\n")
Lucas Fortini
  • 2,420
  • 15
  • 26