[R] about the char _

Philippe Grosjean phgrosje at ulb.ac.be
Fri Oct 5 09:56:24 CEST 2001


>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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list