[R-pkg-devel] Macros in Rd files.

Duncan Murdoch murdoch.duncan at gmail.com
Thu Nov 9 11:40:21 CET 2017


On 09/11/2017 5:06 AM, Uwe Ligges wrote:
> Note the % may be a comment?
> 

Yes, and the body should be written in Rd markup, not R.  Working out 
the appropriate number of escapes is painful; I recommend trial and error.

This worked for me:

  \newcommand{\today}{\Sexpr{format(Sys.Date(),"\\\%d/\\\%m/\\\%Y")}}

Duncan Murdoch

> Uwe
> 
> 
> On 09.11.2017 06:05, Rolf Turner wrote:
>>
>> I tried to define a macro to produce today's date (like unto the
>> "\today" command in LaTeX):
>>
>> \newcommand{\today}{format(Sys.date(),"%d/%m/%Y")}
>>
>> I put this into my *.Rd file just before invoking it.  (Something like
>> "I don't think I will do any more work today (i.e. \today).")
>>
>> When I did
>>
>>       R CMD build ldEst
>>
>> to my package I got the warning:
>>
>>> Warning:
>>> /tmp/RtmpL6sNnQ/Rbuild7f3036693218/ldEst/man/sampleCiLength.Rd:95:
>>> unexpected END_OF_INPUT '\keyword{ datagen }
>>
>> Clearly I'm stuffing something up.  Can some kind soul please provide me
>> with guidance as to what I *should* be doing?
>>
>> Ta.
>>
>> cheers,
>>
>> Rolf Turner
>>
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list