[R] auto-loading package possible?

Liaw, Andy andy_liaw at merck.com
Wed Jul 3 14:26:52 CEST 2002

Apparently I only had faint impression of what autoload does.  What Thomas
described will do what I want, even though it's not as automatic as one
would hope.  In my case I know most of the methods and the packages they're
in, so doing it this way is not a problem at all.

Thanks to all who responded!!


> -----Original Message-----
> From: Thomas Lumley [mailto:tlumley at u.washington.edu]
> Sent: Tuesday, July 02, 2002 11:05 AM
> To: Liaw, Andy
> Cc: 'r-help at stat.math.ethz.ch'
> Subject: Re: [R] auto-loading package possible?
> On Tue, 2 Jul 2002, Liaw, Andy wrote:
> > Dear R-help,
> >
> > Yes, I do know about the auto-loading feature.  My question is more
> > complicated than that:
> >
> You can use the autoloading feature for this (at least for 
> packages using
> old classes) if all you need is print methods.
> It's fairly straightforward to get a list of all the 
> print.foo functions
> in all the installed packages. For example, load the package, 
> use ls() to
> get the object names, and grep for names beginning "print.". 
> Use this to
> create a file of autoload() statements like
>  	autoload("print.Surv","survival")
> 	autoload("print.coxph","survival")
> 	autoload("print.nlme","nlme")
> and so on, and read this from your .Rprofile.
> As long as the names are unique this will do what you are 
> asking (and if
> they're not unique then it's pretty much impossible). It does 
> need to be
> updated when you install new packages.
> Doing this in general is much harder, as has been pointed out.
> 	-thomas

Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.


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