Statistics
| Revision:

root / branches / pthreads-737 / examples / admb-re / glmmadmb / docs / glmmADMB / R / glmmADMB @ 765

History | View | Annotate | Download (672 Bytes)

1
.First.lib <- function(libname, pkgname)
2
{
3
    fullName <- paste("package", pkgname, sep=":")
4
    myEnv <- as.environment(match(fullName, search()))
5
    barepackage <- sub("([^-]+)_.*", "\\1", pkgname)
6
    dbbase <- file.path(libname, pkgname, "R", barepackage)
7
    rm(.First.lib, envir = myEnv)
8
    lazyLoad(dbbase, myEnv)
9
    if(exists(".First.lib", envir = myEnv, inherits = FALSE)) {
10
        f <- get(".First.lib", envir = myEnv, inherits = FALSE)
11
        if(is.function(f))
12
            f(libname, pkgname)
13
        else
14
            stop(gettextf("package '%s' has a non-function '.First.lib'",
15
                          pkgname),
16
                 domain = NA)
17
    }
18
}