[Rd] escaping 'comment' chars in example sections
Antonio, Fabio Di Narzo
antonio.fabio at gmail.com
Fri May 21 16:59:00 CEST 2010
Dear list,
I've noticed that, when writing examples in an Rd file, you need to
escape the '%' character, even if it is valid R code.
I can see maybe this is the intended behaviour, but I found it a bit
surprising, and leads to cryptic error messages from 'R CMD check'.
The relevant section in the "writing R extensions" manual isn't clear
on that point either.
To reproduce the behaviour I'm talking about, you can run this snippet:
##
library(tools)
Rd2ex(parse_Rd(textConnection("
\\title{a}
\\name{b}
\\examples{
'a' %in% letters
}
")))
##
You can see that everything from '%' on is dropped from the output, as
a regular Rd comment. Should this be mentioned in the manual?
cheers,
fabio.
> R.version
_
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status Patched
major 2
minor 11.0
year 2010
month 05
day 19
svn rev 52043
language R
version.string R version 2.11.0 Patched (2010-05-19 r52043)
--
Antonio Fabio Di Narzo, PhD.
Swiss Institute for Bioinformatics - Bioinformatics Core Facility
Office 2029, Génopode, Quartier Sorge
CH-1015 Lausanne, Switzerland
Tel: +41 21 692 4087
Fax: +41 21 692 4065
More information about the R-devel
mailing list