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

mmiller3 at iupui.edu mmiller3 at iupui.edu
Mon May 24 17:58:22 CEST 2004


Full_Name: Mike Miller
Version: 1.9.0
OS: win2000
Submission from: (NULL) (134.68.121.109)


The docs for make.names imply that the result of 

   make.names(c("a and b", "a_and_b"), unique=TRUE)

should be 
   
    "a.and.b"  "a.and.b.1"

when it is actually 

    "a.and.b" "a_and_b"

The docs do not reflect this very major change in behavior from 1.8.x to 1.9.0. 
This change causes numerous R codes to fail in senarios like the following. 
Suppose I have a data file, example.dat, like this:

a b x   some_factor
1 1 0.4 orange
2 1 0.3 blue
1 1 0.2 dog
2 1 0.1 orange
1 2 0.4 blue
2 2 0.3 dog
1 2 0.2 orange
2 2 0.1 blue

To read and use this in a version independent way, I've tried to write
version-aware code, but this is difficult as '_' is not syntactically valid
prior to R 1.9.0.  If it were, the following code might work.  Of course, if '_'
were allowed, this issue would not be be a problem.

df <- read.table('example.dat',header=T)
if ( version['minor'] == "9.0" ) {
  plot(x ~ some_factor, data=df)
} else {
  plot(x ~ some.factor, data=df)
}



More information about the R-devel mailing list