[Rd] Underscore character in Rd files

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Mar 3 14:24:08 CET 2005

On Thu, 3 Mar 2005, Martin Keller-Ressel wrote:

> Hi,
> I'm trying to document a data frame in Rd format. The data frame contains a 
> variable called
> 'Health_Env'. When I create a template for the Rd file using 'prompt()' the 
> variable name is
> included as-is and when I run R CMD CHECK I get a latex error because latex 
> considers '_' a special character (used for subscripts) which is only allowed 
> in math mode.
> When I replace the variable name with 'Health\_Env' in the Rd file latex runs 
> fine, but I get a codoc-mismatch warning because the backslash is not part of 
> the variable name in the data frame.
> Is there a way to completely satisfy R CMD CHECK in this case and avoid both 
> errors and warnings??

Don't use _ in the \name field (as documented in `Writing R Extensions' 
for your version), or update your R: from the NEWS of R-devel (development 
releases available on CRAN for Windows)

     o	There are no longer any restrictions on characters in the
 	\name{} field of a .Rd file: in particular _ is supported.

> I'm using
>> version
>         _
> platform i386-pc-mingw32
> arch     i386
> os       mingw32
> system   i386, mingw32
> status
> major    2
> minor    0.0
> year     2004
> month    10
> day      04
> language R

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list