Hello,

I would find it very usefull to have the ability to load packages with options.
Consider for example the SciViews package Philippe and me are working on. When loading on Windows, it automatically loads the associated GUI executable. It should be convenient to have an option not to load the exe but still have an access to the R functions of the package.


For that, I think a simple change to 'library' would do the trick, which is to add '...' to it, as it is not used for the moment.

The definition of library would then be:

----
function (package, help, pos = 2, lib.loc = NULL, character.only = FALSE,
logical.return = FALSE, warn.conflicts = TRUE, keep.source = getOption("keep.source.pkgs"),
verbose = getOption("verbose"), version,...)
#
# Stuff removed to show which lines are changed later
#
.Internal(lib.fixup(loadenv, env))
if (exists(".First.lib", mode = "function", envir = env,
inherits = FALSE)) {
firstlib <- get(".First.lib", mode = "function",
envir = env, inherits = FALSE)
tt <- try(firstlib(which.lib.loc, package,...))
if (inherits(tt, "try-error"))
if (logical.return)
return(FALSE)
else stop(".First.lib failed")
}
if (!is.null(firstlib <- getOption(".First.lib")[[package]])) {
tt <- try(firstlib(which.lib.loc, package,...))
if (inherits(tt, "try-error"))
if (logical.return)
return(FALSE)
else stop(".First.lib failed")
}
---------


Then, in a package, the maintener can decide to include as many options as desired within his ".First.lib"

".First.lib" <- function(lib,pkg,showGUI=TRUE,useWidgets="TclTk")
{
        if (showGUI) #
}

I am quite sure many packages could benefit from such an additionnal loading options

Eric
Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium

tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre

If the statistics are boring, then you've got the wrong numbers. -Edward Tufte

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

Reply via email to