[R] help on R programming.

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 24 08:24:28 CEST 2003


On Mon, 23 Jun 2003, Murad Nayal wrote:

> - what is the correct way to -remove- a component from a list. this
> seems to do the trick: list[[1]] = NULL, however, you'd think this
> should simply attach a NULL object at the first component position?  

This is in the FAQ, section 3.3.3, and is an S/R difference that catches
people quite often.  It's related to the difference between [] and [[]].

Generally you will find that it is better to program by generating whole 
lists with lapply() or to copy lists retaining what you want (which does 
not copy the components, in general, and so is cheap).


As for your comments on books: `S Programming' does discuss the design of
classes (both informal and formal), the main data sructures in R. As
others have said, the Green Book (Chambers, 1998) is by not means out of
date, except in the sense that the precise langage it describes has never
been available: it is not a description of any version of S-PLUS nor R.

Generally, though, you need to make sure you have at your fingertips the
resources which come with R: the various manuals (including R-lang) and
the on-line help.  For example, I have just spend several days documenting
in the help pages exactly how subscripting of data frames works (and
correcting dozens of anomalies and bugs).

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