[Roxygen-devel] Allow % in @example files

Daniel Sabanés Bové daniel.sabanesbove at ifspm.uzh.ch
Mon Sep 13 15:50:04 CEST 2010


Hi,

I like the @example roclet very much because it allows for clean
separation of function documentation and example code. However, today I
experienced that the percent symbol (%) is interpreted as a comment
character. (This is at least the case in R 2.11.1, which I am using, and
presumably since R 2.9.0, as described in a documentation by Duncan
Murdoch [1].) So we get in trouble when the example.R file contains
matrix multiplication "a %*% b", because R CMD check will just see "a",
the rest of the line being a comment.

Fortunately it is easy to get roxygen to replace all % symbols in the
@example files with "\%", so that the resulting Rd file is correct: I
have attached the two necessary patches to Rd.R and Rd2.R, based on the
release version 0.1-2.

Hope this is useful,

best regards
Daniel

[1] http://developer.r-project.org/parseRd.pdf


More information about the Roxygen-devel mailing list