Prof Brian Ripley
2000-Oct-03 14:05 UTC
(fwd) Re: [R] the underscore ("_") in variable name
> Date: Tue, 03 Oct 2000 14:45:32 +0000 > From: Alberto Murta <amurta at ipimar.pt> > > Duncan Murdoch wrote: > > > I don't follow this argument. Underscore isn't used anywhere else in > > the language, so when you see one, you know it's an assignment. On > > the other hand, both "<" and "-" have multiple other uses. This leads > > to lots of possibilities for confusion: > > > > x <--5 > > x < -5 > > x <- 5 > > Those are classic examples. Nevertheless, "<-" is more appealing visually than"_"> as an assignment operator, mainly because "_" is used in file and variablenames> in other programming languages. > > > (Of course, I actually prefer the Pascalian :=, but I realize that > > puts me in a double minority :-). > > > > Here I agree with you. I think that future releases of R should have "=" asthe> assignement operator, just like the last version of S.Note, "=" is *one of* the allowed assignment operators in Svr4, but not *the* assignment operator and it is only allowed where it would not lead to ambiguities. If you take your S code and globally substitute "=" for "<-" you are likely to find it badly broken. Bill Venables and I did go down that route at one time, but after we discovered that we just did not stop using "=" where it did not work as assignment, we gave up. "<-" is the preferred assignment operator in S-PLUS 5.x and 6.x, with good reasons. This is much subtler than the inaccurate typing earlier in this thread. (I'll leave John Chambers to comment if `the last version of S' has yet arrived.) -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley wrote:> (I'll leave John Chambers to comment if `the last version of S' has yet > arrived.)I'm sorry. I meant 'latest'. In portuguese we use the same word for 'last' and 'latest'. Alberto -- __________________ Alberto G. Murta ______________________ IPIMAR - Institute of Fisheries and Sea Research Avenida de Brasilia; 1449-006 Lisboa; Portugal Tel:351 213027062; Fax:351 213015948; http://www.ipimar.pt -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20001003/5f6d794d/attachment.html