The following MWE fails to compile (via devtools::document()
):
#' MWE
#'
#' @examples
#' format('{}') # Works
#' format('{') # Nope
#' format('\{') # Nope
#' format('\\{')# Nope
format = function (str) {}
Regardless of which of the “Nope” lines I include, it always fails with the error
Failure in roxygen block beginning mwe.r:1
Mismatched braces …
According to my reading of the Rd documentation, this should work by escaping the brace. However, as shown above, this does not work. Am I doing something wrong or is this a bug in Roxygen?
One hint that this might be a Roxygen bug is the full error message when I use the single-escaped version (format('\{')
):
Mismatched braces:
"@example format('{}') # Works format('\\{') # Nope"
Note that the single backslash in the input has been doubled in the output.
\examples{}
section – Adelaidaadelaide