Assignment operators (was [R] modifying a vector)
Sun, 30 Jun 2002 18:57:38 +0100 (BST)
On Sun, 30 Jun 2002, Frank E Harrell Jr wrote:
> On 30 Jun 2002 09:12:31 -0700
> "A.J. Rossini" <email@example.com> wrote:
> > >>>>> "john" == John Fox <firstname.lastname@example.org> writes:
> > john> The equal sign has already been provided as an alternative assignment
> > john> operator in R.
> > And I feel the same way about "=" as I do about "_". Yech.
> I'll second that. And we've already seen the big trouble that can be
caused by "=" (e.g., mistyping sex=='male' as sex='male') that was not
envisioned by the developers. -Frank Harrell
Was that actually in R (where very few people use =)? Unlike S4, = is not
a general-purpose assignment operator, and this sort of thing *was*
`envisioned by the developers'. For example, if(sex = "male") is a syntax
error in R. (Some more insidious ones, such as using assignment in the
a function call, are also disallowed.)
If there is evidence that this is regularly causing trouble we would want
to re-consider its scope, but the availability of `=' is hardly publicised
(and not even the editor of the Programmer's Niche remembered about it).
(Moved to R-devel, as maybe R-help should be spared this source of
Brian D. Ripley, email@example.com
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-devel 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: firstname.lastname@example.org