[R] escaping % in Rd files

Jim Lemon jim at bitwrit.com.au
Sun Aug 18 13:57:40 CEST 2013


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.

Jim



More information about the R-help mailing list