[R] a newbie question about "data"

Bill.Venables at csiro.au Bill.Venables at csiro.au
Thu Nov 8 05:48:35 CET 2007


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.



More information about the R-help mailing list