From P.Dalgaard at biostat.ku.dk  Thu Jan 15 19:14:44 2009
From: P.Dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Thu, 15 Jan 2009 19:14:44 +0100
Subject: [Rd] [Q] R CMD check signals error on code that works from UI
In-Reply-To: <1A68FCB28DE72F4BA3B967E6506CCE43047DF59E@mildnpexmb01.maninvestments.ad.man.com>
References: <Pine.OSF.4.58.0901151139290.220401@wotan.mdacc.tmc.edu>
	<1A68FCB28DE72F4BA3B967E6506CCE43047DF59E@mildnpexmb01.maninvestments.ad.man.com>
Message-ID: <496F7D14.3060603@biostat.ku.dk>

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



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