Assignment operators (was [R] modifying a vector)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
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" <rossini@blindglobe.net> wrote:
>
> > >>>>> "john" == John Fox <jfox@mcmail.cis.mcmaster.ca> 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
Frank,
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).
Brian
(Moved to R-devel, as maybe R-help should be spared this source of
confusion.)
--
Brian D. Ripley, ripley@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-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: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._