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.
Not sure when this was fixed but with roxygen2
version 6.0.1
this issue seems resolved.
devtools::document()
on the MWE produces a valid Rd:
\examples{
format('{}')
format('{')
format('\\{')
format('\\\\{')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With