[R] R annoyances

Liaw, Andy andy_liaw at merck.com
Fri May 20 14:14:24 CEST 2005


> From: Robin Hankin
> 
> On May 20, 2005, at 11:00 am, Jan T. Kim wrote:
> 
> > On Thu, May 19, 2005 at 03:10:53PM -0400, John Fox wrote:
> >
> >> Since you can use variables named c, q, or t in any event, I don't 
> >> see why
> >> the existence of functions with these names is much of an 
> impediment.
> >
> > True, particularly since I'm not too likely to use these 
> variables for 
> > (local)
> > functions, and variables of other types don't prevent 
> functions from 
> > working.
> > (I thought this was a problem... I must be spoilt by 
> recently having 
> > to read
> > too much Matlab code, where parentheses are used to both enclose 
> > subscripts and
> > parameter lists, thus rendering subscript expressions and function 
> > calls
> > syntactically indistinguishable.)
> 
> 
> Heh, I'm a recovering Matlab  user too.  This is sooooooooooo true!
> 
> In Matlab:
> 
> f(10)    # function f() evaluated at 10
> f(10)    # 10th element of vector f.  confusing!!
> 
> R uses round brackets in two unrelated ways:
> 
>   4*(1+2)  --- using "(" and ")" to signify grouping
> f(8)  function f() evaluated at 8.
> 
> where there is no reason to use the same parenthesis symbol for both 
> tasks.

The same is done in Fortran/C/C++/Java/Python and God knows how many
others...
 
> IMO, the only system with consistent parenthesis use is Mathematica;
> 
> f[10]  #  function f[] evaluated at 10
> 8*(2+2)   # parenthesis to override  order of operations
> f[[3]] # third element of list f
> 
> {} are used for sets.

Just out of curiosity, what's used for grouping expressions?

Andy
 
> 
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 
>




More information about the R-help mailing list