[R] R annoyances
Robin Hankin
r.hankin at noc.soton.ac.uk
Fri May 20 16:21:24 CEST 2005
On May 20, 2005, at 01:14 pm, Liaw, Andy wrote:
[snip]
>> 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...
>
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.
>> 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?
>
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.
> Andy
>
>
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
More information about the R-help
mailing list