# \t tab, \n newline, \r carriage return
# \" double quote, \' single quote, \\ backslash
escaped <- "She said \"Hello!\" to me."
# escaped = She said "Hello!" to me.
# Другие кавычки: экранировать не нужно
other_quotes <- 'She said "Hello!" to me.'
apostrophe <- "It's fine"
# По шестнадцатеричному коду и коду Unicode
capital_a <- c("\x41", "\u0041")
# capital_a = A A
# \\ - один обратный слеш
path <- "C:\\Temp\\new"
# path = C:\Temp\new
# Добавляем кавычки: FALSE даёт простые
quoted <- dQuote("Hello!", FALSE)
# quoted = "Hello!"
# Для команды оболочки
shell_text <- shQuote("my file")
# shell_text = 'my file'
cat("escaped =", escaped, "\n")
cat("other_quotes =", other_quotes, "\n")
cat("apostrophe =", apostrophe, "\n")
cat("capital_a =", capital_a, "\n")
cat("path =", path, "\n")
cat("quoted =", quoted, "\n")
cat("shell_text =", shell_text, "\n")
# print() снова показывает escape-последовательности
print(path)