[R] about the char _

Frank E Harrell Jr fharrell at virginia.edu
Fri Oct 5 15:35:53 CEST 2001


I have to agree with Laurent.  I don't think this is a
big issue.  I've been importing SAS datasets into S
for 10 years and have not ever been disappointed to
see a period instead of an underscore in a variable
name.

In addition it is very important to maintain compatibility
with S-Plus on this issue.

Users of ESS under Emacs can be lazy and politically
correct also as _ is immediately expanded to <-

Frank


Laurent Gautier wrote:
> 
> I do not want to pour oil on fire (see the "S-Plus != R" earlier this
> week).
> (I am writing in peace. =)  )
> 
> I do not see the 'underscore' thing as a _major_ issue.
> 
> If one really really really want to have underscores, one still can:
> 
> > "underscore_if_I_want" <- 2
> > get("underscore_if_I_want")
> [1] 2
> 
> Regards,
> 
> Laurent
> 
> Philippe Grosjean wrote:
> >
> > >Dear all,
> >
> > >I don't know the historical reason why the char '_' was
> > >defined in the R language grammar as a synonyme of the
> > >assignment <-, anyway the R documentation dosen't recommand
> > >its usage.
> >
> > >Well, this is a real "incompatibility issue" each time
> > >we need to interface R with other language/systems, notably with
> > >database systems. Recall that, in perhaps all computer systems,
> > >the char '_' can be used in the name of a variable or a column
> > >in a data table.
> >
> > >So that's my question : is there an option to change this
> > >behaviour ?
> >
> > >All that I want is the possibility to use the same name of
> > >variables in my R source as they are declared in the other systems.
> >
> > >Thanks
> > >--
> > >Fan
> >
> > I totally agree with this. Since _ is a deprecated synonym of <-, is it any
> > possibility to eliminate it in one of the next major versions of R?
> > Therefore, a variable name like my_variable would become viable... like in
> > most other computer languages. What I really appreciate in R synthax is that
> > there is almost no ambiguities. I mean, in R, a word has only one
> > signification. For instance <- is assignation, = gives a value to an
> > argument in a function and == is for comparison, where some other languages
> > use the same = in the different situations. As far as I know, there are only
> > two cases where the same word (or character) can be used in two different
> > situations:
> > 1) A function, and an argument in a function can both have the same name,
> > i.e., myfunction <- function(myfunction="value", arg2,...) {} is viable;
> > 2) The dot is used both in variable names and to represent the object
> > hierarchy: my.var and print.myvar. The first dot is part of the variable
> > name, while the second dot separate the method (print) and the variable
> > (myvar). If _ was allowed in variables names, we could use print.my_var
> > (which should, perhaps, be recommended) and it would be easier to spot where
> > is the "object hierarchy" and where is the variable name.
> > Best,
> >
> > Philippe Grosjean
> >
> > ...........]<(({?<...............<?}))><...............................
> >  ) ) ) ) )       __                      __
> > ( ( ( ( (       |__)                    |  _
> >  ) ) ) ) )      |   hilippe             |__)rosjean
> > ( ( ( ( (       Marine Biol. Lab., ULB, Belgium
> >  ) ) ) ) )                               __
> > ( ( ( ( (       |\  /|                  |__)
> >  ) ) ) ) )      | \/ |ariculture &      |__)iostatistics
> > ( ( ( ( (
> >  ) ) ) ) )      e-mail: phgrosje at ulb.ac.be or phgrosjean at sciviews.org
> > ( ( ( ( (       SciViews project coordinator (http://www.sciviews.org)
> >  ) ) ) ) )      tel: 00-32-2-650.29.70 (lab), 00-32-2-673.31.33 (home)
> > ( ( ( ( (
> >  ) ) ) ) )      "I'm 100% confident that p is between 0 and 1"
> > ( ( ( ( (                                  L. Gonick & W. Smith (1993)
> >  ) ) ) ) )
> > .......................................................................
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 
> --
> Laurent Gautier                 CBS, Building 208, DTU
> PhD. Student                    D-2800 Lyngby,Denmark
> tel: +45 45 25 24 85            http://www.cbs.dtu.dk/laurent
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list