[R] a newbie question about "data"

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 8 08:30:46 CET 2007


A lot of those changes are of course in the on-line Errata at
http://www.stats.ox.ac.uk/pub/MASS4/Errata4.1 . E.g.

R Changes
=========

p.12  As from R 1.7.0 data() is not needed for our datasets, but it
       is needed for R's own datasets  ability.cov, iris3  and swiss
       prior to R 2.0.0.


On Thu, 8 Nov 2007, Bill.Venables at csiro.au wrote:

> The book came out in 2002 and a lot has happened with R in the time since then.  In particular it is now possible for R to have 'lazy loading' of objects.  If the person setting up the package has used this option (as they all now should), when the package is loaded R essentially is made aware that the data (and other) objects are there, so it is visible, but it is only read into memory if it is used.  The little tag that alerts R to the existence of the object and triggers the automatic loading on demand is called a 'promise' and the action itself is called a 'delayed assign'.
>
> Previously this all had to be done manually.  data() could be used either to discover what data objects were available in packages, or to load them in to memory.  Many old-style packages still require you to do this.  There are cases where it is justified, I suppose, but they are quite hard to think of...
>
> With R you have to keep abreast of developments, and it's all happening pretty fast.
>
> Bill Venables.
>
> PS Since you are new to R, it is not considered very friendly to send messages to the R groups anonymously.
>
>
> Bill Venables
> CSIRO Laboratories
> PO Box 120, Cleveland, 4163
> AUSTRALIA
> Office Phone (email preferred): +61 7 3826 7251
> Fax (if absolutely necessary):  +61 7 3826 7304
> Mobile:                         +61 4 8819 4402
> Home Phone:                     +61 7 3286 7700
> mailto:Bill.Venables at csiro.au <mailto:Bill.Venables at csiro.au>
> http://www.cmis.csiro.au/bill.venables/ <http://www.cmis.csiro.au/bill.venables/>
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org <mailto:r-help-bounces at r-project.org> ] On Behalf Of envisage
> Sent: Thursday, 8 November 2007 1:27 PM
> To: r-help at r-project.org
> Subject: [R] a newbie question about "data"
>
> hi, I am reading Modern Applied Statistics with S 4th ed¡£
> page4 have these two lines:
>> library(MASS)
>> data(chem) # needed in R only
> but I find withou the line " data(chem)"
> I can still access chem, isn't it?
> is it unnecessary or something i missed here?
> thanks for the replay in advance.
>
>

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