SCM

SCM Repository

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

Diff of /pkg/R/zzz.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1056, Tue Nov 22 16:40:49 2005 UTC revision 1289, Tue Jun 6 14:48:37 2006 UTC
# Line 4  Line 4 
4  .onLoad <- function(libname, pkgname)  .onLoad <- function(libname, pkgname)
5  {  {
6      require(methods)      require(methods)
7        require(utils) # -> assignInNamespace {but "anyway"}
8    
9      ## The following works around namespace-protection on purpose:      ## The following works around namespace-protection on purpose:
10      assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base")      assignInNamespace("..Old..as.matrix", base::as.matrix, ns = "base")
11      assignInNamespace("..Old..as.array", base::as.array, ns = "base")      assignInNamespace("..Old..as.array", base::as.array, ns = "base")
12    
13        if(paste(R.version$major, R.version$minor, sep=".") >= "2.4") {
14            ## For R 2.4.0 and newer, need to also set the baseenv() --
15            ##  the following being really a hack:
16            tmp <- function(x) {
17                if(methods:::seemsS4Object(x)) Matrix::as.matrix(x)
18                else UseMethod("as.matrix")
19            }
20            environment(tmp) <- baseenv()
21            assignInNamespace("as.matrix", tmp, ns = "base")
22        } else {
23      assignInNamespace("as.matrix", as.matrix, ns = "base")      assignInNamespace("as.matrix", as.matrix, ns = "base")
24        }
25        ## does not (yet) need special treatment, since it's not S3 generic:
26      assignInNamespace("as.array", as.array, ns = "base")      assignInNamespace("as.array", as.array, ns = "base")
27    
28      ## Now all the functions in 'base' that start with something like      ## Now all the functions in 'base' that start with something like
29      ##  "x <- as.matrix(x)" or  "X <- as.array(X)"      ##  "x <- as.matrix(x)" or  "X <- as.array(X)"
30      ## will work for 'Matrix'-matrices      ## will work for 'Matrix'-matrices
31    
32      ## kronecker() / %x% -- in principle should re-assigne base::kronecker      ## kronecker() / %x% -- in principle should re-assign base::kronecker
33      ## -----------> ?? performance hit ?? in mantelhaen.test() ??      ## -----------> ?? performance hit ?? in mantelhaen.test() ??
34      ##      ##
35      ## This is formally identical to the base definition, but should use the      ## This is formally identical to the base definition, but should use the

Legend:
Removed from v.1056  
changed lines
  Added in v.1289

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