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

Yihui Xie xie at yihui.name
Sat Jan 5 05:02:40 CET 2013


Just a follow-up: I decided to avoid backslashes in function
arguments, so the problem is now gone for me. But I believe the
possible bug is still in R; if anyone wants to reproduce the problem,
please check out this commit:
https://github.com/yihui/knitr/tree/bf793ca6

https://github.com/yihui/knitr/blob/bf793ca67ac6b78a5b09ab8eb08976ec7667e6e2/man/knit_expand.Rd
https://github.com/yihui/knitr/blob/bf793ca67ac6b78a5b09ab8eb08976ec7667e6e2/R/template.R

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


On Thu, Jan 3, 2013 at 8:17 PM, Yihui Xie <xie at yihui.name> wrote:
> 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