Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

escape_examples

Escape examples


Description

This documentation topic is used primarily for testing and to record our understanding of the \example{} escaping rules. See https://developer.r-project.org/parseRd.pdf for the details provided by R core.

Usage

escape_examples(x)

Examples

# 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{}:

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)

roxygen2

In-Line Documentation for R

v7.1.1
GPL (>= 2)
Authors
Hadley Wickham [aut, cre, cph] (<https://orcid.org/0000-0003-4757-117X>), Peter Danenberg [aut, cph], Gábor Csárdi [aut], Manuel Eugster [aut, cph], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.