[R] Using "_" in names?

Spencer Graves spencer.graves at pdf.com
Tue Nov 4 03:20:36 CET 2003


      I work with data bases that routinely use the underscore, "_", as 
part of names.  I've seen discussion on this list of possibly allowing 
that in a future release of R.  How far are we away from that? 

      I got the following from R 1.8.0 under Windows 2000: 

 > A_1
Error: syntax error
 > A_B <- 1
Error: syntax error
 > "A_B" <- 1
 > DF <- data.frame(A_B=1)
Error: syntax error
 > DF <- data.frame("A_B"=1)
 > DF
  A.B
1   1
 > names(DF) <- "A_B"
 > DF
  A_B
1   1
 > lm("A_B"~1, DF)
Error in terms.formula(formula, data = data) :
        invalid term in model formula
 
      Thanks for your help,
      Spencer Graves




More information about the R-help mailing list