On 13-08-18 7:57 AM, Jim Lemon wrote:> Hi all,
> In trying to write an Rd file for a new package, I was stumped at
> something that is probably quite simple. I have % characters in the
> examples of one Rd file. Both my previous experience and some searching
> argeed that one can escape % with \. This worked on this command:
>
> fh_dates<-
> as.Date(paste(florida_hurr20$day,florida_hurr20$month,
> florida_hurr20$year,sep="-"),"\%d-\%b-\%Y")
>
> which is okay in the HTML help page but it didn't work on another line
> in the same file:
>
> findval<-function(x,set) return(which(set \%in\% x))
>
> The second line was cut off at the first % character in the HTML help
> page. After lots of head scratching I noticed that the first line was
> broken after the assignment so I changed the second line to:
>
> findval<-
> function(x,set) return(which(set \%in\% x))
>
> and it worked properly! I don't know whether this qualifies as
something
> interesting to the core team, but I thought I would let you know.
The syntax of Rd files is pretty complex (because of the way they grew).
Context affects how escaping works. You can see the gruesome details
in the document mentioned in the ?tools::parse_Rd help page.
Duncan Murdoch