# In examples we automatically escape Rd comments (%):
100 %% 30
# even if they are in strings
"50%"
# and \ and \v inside of strings and symbols
"\v" # vertical tab
"\\"
# but not comments: \l \v
# other string escapes are left as is
"\""
"\n"
# Otherwise, backslashes and parentheses are left as is. This
# means that you need to escape unbalanced parentheses, which typically only
# occur in \dontshow{}:
if (FALSE) {
print("Hello")
}
# You also need to escape backslashes in infix operators and comments
# (this is generally rare)
`%\\%` <- function(x, y) x + y
10 %\% 20
# \\ (renders as two backslashes)
Run the code above in your browser using DataLab