Special Characters In Strings

Want to learn more? I recommend working through: R for Data Science, R Cookbook, and R Graphics Cookbook.

There are some special characters that can be added to strings by placing certain characters in the string. To view these characters we use cat() because the default print() converts these escape characters into regular characters.

# Add a tab
cat("cat\tdog")
cat dog
# Add a line break
cat("cat\ndog")
cat
dog