I wanted a data frame component to be named "next", for example:> m <- data.frame (matrix (0, nrow=2, ncol=2)) > names (m) <- c("prev", "next") > mprev next 1 0 0 2 0 0 But "next" being reserved prevents $ indexing without quotes:> m$nextError: syntax error> m$"next"[1] 0 0 Although they are mostly obvious, I can't find in the documentation (using Jon Baron's searcher, at least) a list of these words. Am I missing the documentation, or could such a list be added to a future release? thanks, Denis
I had to read the R sources for `S Programming', which says
There are some reserved words you will not be allowed to use, for example
\begin{source}
FALSE Inf NA NaN NULL TRUE
break else for function if in next repeat while
\end{source}
and in the \s. engines (but not \R.) \sfn{return}, \sfn{F} and \sfn{T}.
[That was the list in 1999, and you would need to check.]
Yes, this should be in R-lang, the `Language Definition', but that is
still a draft.
On Wed, 5 Mar 2003 white.denis at epamail.epa.gov wrote:
> I wanted a data frame component to be named "next", for example:
>
> > m <- data.frame (matrix (0, nrow=2, ncol=2))
> > names (m) <- c("prev", "next")
> > m
> prev next
> 1 0 0
> 2 0 0
>
> But "next" being reserved prevents $ indexing without quotes:
>
> > m$next
> Error: syntax error
> > m$"next"
> [1] 0 0
>
> Although they are mostly obvious, I can't find in the documentation
> (using Jon Baron's searcher, at least) a list of these words. Am I
> missing the documentation, or could such a list be added to a future
> release?
>
> thanks,
> Denis
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
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
Section 10.3.3 in the R Language Manual, as distributed with R. Andy> -----Original Message----- > From: white.denis at epamail.epa.gov [mailto:white.denis at epamail.epa.gov] > Sent: Wednesday, March 05, 2003 1:52 PM > To: r-help at stat.math.ethz.ch > Subject: [R] reserved words documentation > > > I wanted a data frame component to be named "next", for example: > > > m <- data.frame (matrix (0, nrow=2, ncol=2)) > > names (m) <- c("prev", "next") > > m > prev next > 1 0 0 > 2 0 0 > > But "next" being reserved prevents $ indexing without quotes: > > > m$next > Error: syntax error > > m$"next" > [1] 0 0 > > Although they are mostly obvious, I can't find in the documentation > (using Jon Baron's searcher, at least) a list of these words. Am I > missing the documentation, or could such a list be added to a future > release? > > thanks, > Denis > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >------------------------------------------------------------------------------