[R] Problem with % in an example when running R CMD check

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jun 1 00:27:15 CEST 2011


On 11-05-31 5:12 PM, Peter Langfelder wrote:
> I observed the same behaviour some time ago. The .Rd files are
> pre-processed using a latex-like typesetter that discards everything
> following a % sign as comments, even in example R code.
>
> http://r.789695.n4.nabble.com/Rd-file-processing-suggestion-sign-in-examples-td3459570.html

Correct, % signs always need to be escaped if they aren't intended to be 
comments.  Escaping is the usual \%.

This is not anything new, though it may be that other parts of the 
parsing have changed to expose this.

Duncan Murdoch

>
> HTH,
>
> Peter
>
>
> On Tue, May 31, 2011 at 2:08 PM, Frank Harrell<f.harrell at vanderbilt.edu>  wrote:
>> Using
>>
>> platform       x86_64-pc-linux-gnu
>> arch           x86_64
>> os             linux-gnu
>> system         x86_64, linux-gnu
>> status
>> major          2
>> minor          13.0
>> year           2011
>> month          04
>> day            13
>> svn rev        55427
>> language       R
>> version.string R version 2.13.0 (2011-04-13)
>>
>> I am getting an error I haven't seen before when running R CMD check on a
>> package:
>>
>> Warning: parse error in file 'rms-Ex.R':
>> 14: unexpected symbol
>> 376:     f<- ols(y ~ pol(x1,2) + pol(x2,2) + pol(x1,2)
>> 377:              subset
>>                   ^
>> The original (quote old) code in an 'example' section of an .Rd file is:
>>
>>     f<- ols(y ~ pol(x1,2) + pol(x2,2) + pol(x1,2) %ia% pol(x2,2),
>>              subset=group==g)
>>
>> Putting \ before the % gets around the problem but I didn't have to do that
>> before.
>>
>> Any ideas?
>> Thanks Frank
>>
>>
>> -----
>> Frank Harrell
>> Department of Biostatistics, Vanderbilt University
>> --
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list