[R] cannot have a function argument named 'break'

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 3 08:47:51 CET 2003


No, they are reserved names.  That is explained in MASS4 and R-lang, for 
example.  The full list (of syntactically valid names) is

FALSE Inf NA NaN NULL TRUE
break else for function if in next repeat while

(S also has return, T and F)

Most progamming languages have reserved words, so I am surprised you are 
surprised.

On Sun, 2 Nov 2003, Spencer Graves wrote:

> Yup.  R 1.8.0 gives me a syntax error from "if", also: 
> 
>  > iff <- function(if)if
> Error: syntax error
> 
> spencer graves
> 
> Thomas W Blackwell wrote:
> 
> >Dear list  -
> >
> >I just discovered to my surprise that I cannot define
> >a function with an argument named 'break' or 'while'!
> >'breaks' is okay.  Maybe this is no surprise to the R
> >developers.

-- 
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