[R] Problem with package development

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Jun 3 14:02:33 CEST 2011


On Fri, Jun 3, 2011 at 11:51 AM, Sarah Goslee <sarah.goslee at gmail.com> wrote:

> If you don't recognize the official r-project.org R-admin manual as a legitimate
> link then I'm afraid I also can't help you any further since there is nothing
> more legitimate than the official documentation.

 Except the source code! Possible case in point, someone on
StackOverflow was wondering why "0 <= x <= 1" isn't a valid
expression, neither in the context of what he expected (TRUE if x is
between 0 and 1) nor how I explained it would function (as (0<=x) <=
1, and then comparing a TRUE/FALSE against 1) if it were not for the
flagging of comparison operators as non-associative in gram.y in the
source code. I even recompiled R with <= as left associative to check.
Sure enough, I could then type 0 <= 5 <= 1 as a valid expression and
get TRUE returned.

 Now, the user (eventually) understood all of this, but neither he nor
I could find this documented in the R docs. Actually, it sems to
contradict the code [my **emphasis**]:

"The exponentiation operator ‘^’ and the left assignment operators ‘<-
- = <<-’ group right to left, **all other operators** group left to
right. That is, 2 ^ 2 ^ 3 is 2 ^ 8, not 4 ^ 3, whereas 1 - 1 - 1 is
-1, not 1. ".

 Shortly before that the comparison operators (>, < etc) are listed in
a table of precedence with the other operators.

 Actually I reckon this is a clear documentation bug and I should
probably report it... But its lunchtime and there's free cheese...

Barry



More information about the R-help mailing list