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 1214, Wed Feb 8 07:43:07 2006 UTC revision 1289, Tue Jun 6 14:48:37 2006 UTC
# Line 9  Line 9 
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

Legend:
Removed from v.1214  
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