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" <> wrote:
> > >>>>> "john" == John Fox <> 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,        
Professor of Applied Statistics,
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
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: