[Rd] small syntax suggestion

ivo welch ivo.welch at gmail.com
Sun Aug 22 17:33:51 CEST 2010

Dear R development Team:  I really know very little, so you may ignore
this post.  I have found that my students often make the mistake of
mixing up comparisons and assignments with negative numbers:

  if (x<-3) do_something;

I parenthesize, but every once in a while, I forget and commit this
mistake, too.  so, I would suggest that R simply warn about an
ambiguity.  that is, it could suggest a space either between the < and
- , or after the <- .

  x< -3  ## means comparison already
  x<- 3  ## means assignment already
but warn when
  x<-3  ## ambiguity warning instead of assignment
  x<-(whatever)  ## ok

just a suggestion...


Ivo Welch (ivo.welch at brown.edu, ivo.welch at gmail.com)

More information about the R-devel mailing list