[R] Problem with parser and if/else

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 13 17:38:12 CET 2003


On Thu, 13 Nov 2003, Ben Bolker wrote:

>   With all due respect to BDR and you, I think this behavior is not
> obvious to casual/new users (using the R search page with "if else" as the
> search string turns up nearly identical queries from 1998, 2001, and
> 2002).  There's a philosophical issue here, of course, about how much we
> need to hold people's hands/fill the help files with details about
> behavior that is clearly defined but not obvious to beginners.  (And the
> fact that some people don't read help pages anyway ...)
> 
>   I don't have the new edition of MASS (shame on me), but looking at both 
> p. 93 of MASS 3d ed. and at help("if") in R 1.8.0, I don't see this 
> problem clearly highlighted (yes, reading the syntax

Well, do take a look at MASS4 p.58 as it is completely different from that 
citation.

  A little care is needed when entering \sfn{if ... else} statements to
  ensure that the input is not syntactically complete before the \sfn{else}
  clause, and braces can help with achieving this.

That is exactly the point.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list