SCM

SCM Repository

[matrix] Annotation of /pkg/R/zzz.R
ViewVC logotype

Annotation of /pkg/R/zzz.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 973 - (view) (download)

1 : maechler 956 ### Note that "in theory" even base::as.vector() should be overloaded.
2 :     ### In practice that could be too much of a performance penalty in some cases.
3 :    
4 : maechler 829 .onLoad <- function(libname, pkgname)
5 :     {
6 :     ## The following works around namespace-protection on purpose:
7 :     assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base")
8 : maechler 956 assignInNamespace("..Old..as.array", base::as.array, ns = "base")
9 : maechler 829 assignInNamespace("as.matrix", as.matrix, ns = "base")
10 : maechler 956 assignInNamespace("as.array", as.array, ns = "base")
11 : maechler 829 ## Now all the functions in 'base' that start with something like
12 : maechler 956 ## "x <- as.matrix(x)" or "X <- as.array(X)"
13 : maechler 829 ## will work for 'Matrix'-matrices
14 : maechler 908
15 : maechler 973 ## kronecker() / %x% -- in principle should re-assigne base::kronecker
16 :     ## -----------> ?? performance hit ?? in mantelhaen.test() ??
17 :     ##
18 :     ## This is formally identical to the base definition, but should use the
19 :     ## generic kronecker
20 :     assignInNamespace("%x%", function (X, Y) kronecker(X, Y), ns = "base")
21 :    
22 : maechler 908 if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")
23 :     methods:::bind_activation(TRUE)
24 : maechler 829 }
25 :    
26 :     .onUnload <- function(libpath)
27 :     {
28 :     assignInNamespace("as.matrix", base::..Old..as.matrix, ns = "base")
29 : maechler 956 assignInNamespace("as.array", base::..Old..as.array, ns = "base")
30 : maechler 829 library.dynam.unload("Matrix", libpath)
31 : maechler 908
32 :     if(paste(R.version$major, R.version$minor, sep=".") >= "2.2")
33 :     methods:::bind_activation(FALSE)
34 : maechler 829 }

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge