[R] "problem" with delay()
Ray.Brownrigg at mcs.vuw.ac.nz
Sun Jul 2 23:53:51 CEST 2000
> > I have been using delay() quite successfully to 'load on reference'
> > some large data files (earthquake catalogues). One minor difficulty I
> > have not been able to overcome is that upon first reference, the data
> > set is loaded into memory as expected, but also remains as a permanent
> > object in the user's environment, instead of appearing to be only in
> > the library from which it was loaded.
Thomas Lumley <thomas at biostat.washington.edu> replied:
> Your problem is that data() does load the object into the global
> environment. To put data in another environment you need to use load(),
> source(), read.table() &c, explicitly.
> Alternatively, if your data are in the R save() format and you are using
> 1.1.0 or newer you can delay an attach command
> or if the file is in the data subdirectory of "mypackage"
> This loads the file into a new environment in the search path, so it won't
> be saved on exit.
[Almost] exactly what I wanted. The above does not actually provide the
value on first reference, so the minor modification to:
is what works for me.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help