[R] auto-loading package possible?

Thomas Lumley tlumley at u.washington.edu
Tue Jul 2 17:04:57 CEST 2002

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


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