[Rd] Bug in R CMD check for \ in Rd?

Yihui Xie xie at yihui.name
Fri Jan 4 03:17:31 CET 2013


Hi,

I have a function knit_expand() and its source/Rd are below:

https://github.com/yihui/knitr/blob/master/R/template.R#L43-L44
https://github.com/yihui/knitr/blob/master/man/knit_expand.Rd

When I run R CMD check on the package I get this warning (with both R
2.15.2 and R-devel):

* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'knit_expand':
knit_expand
  Code: function(file, ..., text = readLines(file, warn = FALSE), delim
                 = "\\{\\{((.|\n)+?)\\}\\}")
  Docs: function(file, ..., text = readLines(file, warn = FALSE), delim
                 = "\{\{((.|\n)+?)\}\}")
  Mismatches in argument default values:
    Name: 'delim' Code: "\\{\\{((.|\n)+?)\\}\\}" Docs: "\{\{((.|\n)+?)\}\}"


I'm very confused by this warning, because in my Rd, I have this in
the usage section:

knit_expand(file, ..., text = readLines(file, warn = FALSE), delim =
"\\\\{\\\\{((.|\\n)+?)\\\\}\\\\}")

I do not understand why four backslashes became one in R CMD check. I
read http://developer.r-project.org/parseRd.pdf again and it says {}
in character strings do not need to be escaped, so the only character
to escape in this case is the backslash. The text/html help page
rendered from my Rd shows "\\{\\{((.|\n)+?)\\}\\}" correctly. So I'm
wondering if this is a bug of R CMD check, or I misunderstood
anything. Thanks!

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



More information about the R-devel mailing list