[Rd] error in make.names docs (PR#6912)

p.dalgaard at biostat.ku.dk p.dalgaard at biostat.ku.dk
Tue May 25 00:16:58 CEST 2004


Peter Dalgaard <p.dalgaard at biostat.ku.dk> writes:

> Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> 
> > Example output in comment is now corrected in R-patched.
> > What has the rest to do with a bug report?
> 
> He's hoping (with some reason) that the change of behaviour was the
> bug. I seem to recall some internal discussion of the effect, but not
> whether it just got forgotten or whether you might as well just do 
> gsub(...something...) on the names of the dataframe.

Apparently, the latter was the case. It is quite easy to fix the names
after reading, and adding a compatibility feature would be kludgy, and
not relieving you of changing the old code anyway. I have updated the
docs (for 1.9.1) with some more specific instructions about what to do:

diff -r1.9.4.1 make.names.Rd
31a32,36
> \note{
>   Prior to version 1.9.0, underscores were not valid in variable names,
>   and code that relies on them being converted to dots will no longer
>   work. The simplest workaround is to use \code{gsub("_", ".",
>   names)}.
> }

diff -r1.50 read.table.Rd
189a190,196
>
>   Prior to version 1.9.0, underscores were not valid in variable names,
>   and code that relies on them being converted to dots will no longer
>   work. The simplest workaround is to use
>    \code{names(d) <- gsub("_", ".", names(d))},
>   or, avoiding the (small) risk of creating duplicate names,
>    \code{names(d) <- make.names(gsub("_", ".", names(d)),
>   unique=TRUE)}.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list