Skip to content

R annoyances

5 messages · Liaw, Andy, Philippe GROSJEAN, Jan T. Kim +2 more

#
The same is done in Fortran/C/C++/Java/Python and God knows how many
others...
Just out of curiosity, what's used for grouping expressions?

Andy
#
Hello,
Regarding use of parenthesis, it is true that R is much better with 
f(10) != f[10] != f[[10]], where Matlab is a little confusing. Also, in 
Matlab, you can use some functions without (), further adding to the 
confusion (the only example that comes to my mind in R is the use of '?' 
as shortcut for help()).

However, there is still a double use of () in R: it is both used for 
enclosing function arguments and for grouping operations. One language 
has a syntax that makes a totally unambiguous use of [], () and {} is 
Mathematica: [] is for subscript, {} is for function arguments and () is 
for grouping... but Mathematica code is really a pain to typeset and read.

So, all in all, I really like the S langage syntax: it is very readable 
and reasonably rigid...

Regarding T and F, I took the habit to *always* type them TRUE or FALSE. 
Again, very readable and not confusing at all. If T and F as equivalent 
to TRUE and FALSE would ever be deprecated and then defunct in further 
versions of R, well, I would not complain about it!

The only aspect I don't like is a too loosely use of the dot in 
functions: both in functions names, in object classes and in generic 
functions / methods. Hence, we have for instance: 'data.frame', 
'help.search' and 'summary.matrix'... just guess which one is an object 
class, which one is an ordinary function and which one is a S3 method 
(OK, S4 solves somehow the problem)? It would have been much better to 
*reserve* the use of a dot in a function name as a separator between the 
name of the generic function and the class to which it applies. Thus, 
'summary.matrix' would have been correct, but both 'data.frame' and 
'help.search' should have been spelled differently, perhaps 'dataframe' 
and 'helpSearch'. Just a dream... because 'data.frame' will of course 
never be spelled differently!!!
Best,

Philippe Grosjean
Jan T. Kim wrote:
#
On Fri, May 20, 2005 at 08:14:24AM -0400, Liaw, Andy wrote:
And this is different from the subscripting / function call ambiguity,
as these languages (to the extent I know them) are designed such that
parentheses for precedence control are syntactically distinguishable
from those used for function parameter lists: If the opening parenthesis
is preceded by an identifier, that identifier is a function name and
the parenthesis opens a parameter list.

(Python is a somewhat messy case, though, because it uses parentheses
for tuples too.)

Best regards, Jan
#
On May 20, 2005, at 01:14 pm, Liaw, Andy wrote:
[snip]
well yes, but that doesn't mean it's the Right Thing To Do (tm).

Gabor points out that "f(10)" having meaning whether f is a vector or a 
function
is interesting.  I guess this is right, but I can't think of a 
real-life situation in which
this would be useful.
all statements on a line are executed sequentially.   Execution 
continues to next line
if there are any unmatched parentheses or dangling operators.

  So it's a bit pythonesque.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743
#
On 20 May 2005, at 16:37, Philippe Grosjean wrote:

            
The most beautiful thing in old R (I started with 0.63) was that it was 
in the elegant unix tradition: all lower case and point (full stop, 
period, whatever) in places where you needed it. It is unfortunate that 
other languages are creeping in and old neat constructions are replaces 
with C++ style uGliNess. There was a grace period when switching from 
beautiful (fair) print.coefmat to ugLy printCoefmat, but some changes 
were more abrupt (package.description). I have a feeling that the 
recent trashing of names.dist (with a lot of code breakage even in base 
R) was caused by the same kind of political correctness.

Please Mr R, keep it like it used to be...

cheers, jari oksanen
--
Jari Oksanen, Oulu, Finland