SCM

SCM Repository

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

Diff of /pkg/R/Matrix.R

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

revision 1346, Thu Aug 3 17:17:55 2006 UTC revision 1347, Mon Aug 7 08:47:43 2006 UTC
# Line 17  Line 17 
17  setMethod("as.matrix", signature(x = "Matrix"), function(x) as(x, "matrix"))  setMethod("as.matrix", signature(x = "Matrix"), function(x) as(x, "matrix"))
18  ## for 'Matrix' objects, as.array() should be equivalent:  ## for 'Matrix' objects, as.array() should be equivalent:
19  setMethod("as.array",  signature(x = "Matrix"), function(x) as(x, "matrix"))  setMethod("as.array",  signature(x = "Matrix"), function(x) as(x, "matrix"))
20  ## head and tail apply to all Matrix objects for which subscripting is allowed  
21  setMethod("head", signature(x = "Matrix"),  ## head and tail apply to all Matrix objects for which subscripting is allowed:
22            function(x, n = 6, ...)  setMethod("head", signature(x = "Matrix"), utils:::head.matrix)
23            x[seq(len = min(n, nrow(x))), , drop = FALSE])  setMethod("tail", signature(x = "Matrix"), utils:::tail.matrix)
 setMethod("tail", signature(x = "Matrix"),  
           function (x, n = 6, addrownums = TRUE, ...)  
       {  
           nrx <- nrow(x)  
           sel <- seq(to = nrx, length = min(n, nrx))  
           ans <- x[sel, , drop = FALSE]  
           if (addrownums && is.null(rownames(x)))  
               rownames(ans) <- paste("[", sel, ",]", sep = "")  
           ans  
       })  
24    
25  ## slow "fall back" method {subclasses should have faster ones}:  ## slow "fall back" method {subclasses should have faster ones}:
26  setMethod("as.vector", signature(x = "Matrix", mode = "missing"),  setMethod("as.vector", signature(x = "Matrix", mode = "missing"),

Legend:
Removed from v.1346  
changed lines
  Added in v.1347

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