[Rd] [Q] R CMD check signals error on code that works from UI

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Thu Jan 15 19:14:44 CET 2009


Sklyar, Oleg (London) wrote:
> Because there is a % sign, which is stripped out by LaTeX used to build
> the help system as a comment. Just look at how your example code is
> output -- the string is unterminated because the matching quote is
> masked by % latex comment

Minor quibble: Actually, LaTeX is not used at this stage, but the Rd
format is LaTeX-like, and in particular uses the same "%" comment
character.

In any case, the fix is to excape the "%" as "\%", whenever you need one
in an Rd file, even inside code examples.

	-pd

>>> ## :WHY: The following kills R CMD check but runs fine on console.
>> foos <- c("aaa", "bbb", "ccc")
>> cat(sapply(foos,
>>            function(foo) {
>>                sprintf("name: %-18s upper: %s\n",
>>                        foo,
>>                        toupper(foo))
>>            }), sep="")
>

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-devel mailing list