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 907, Thu Sep 8 15:28:48 2005 UTC revision 908, Thu Sep 8 15:30:08 2005 UTC
# Line 158  Line 158 
158    
159    
160    
161    ## NOTE: the following only works for R 2.2.x (and later) ---
162    ## ----  *and* 'Matrix' must have been *installed* by R >= 2.2.x
163    
164  if(FALSE) ## The following can't work as long as cbind is function(..., *)  if(paste(R.version$major, R.version$minor, sep=".") >= "2.2") {
165  setMethod("cbind", signature(a = "Matrix", b = "Matrix"),  
166            function(a, b, ...) {      ## The trivial methods :
167                da <- Dim(a)      setMethod("cbind2", signature(x = "Matrix", y = "NULL"),
168                db <- Dim(b)                function(x, y) x)
169                if(da[1] != db[1])      setMethod("cbind2", signature(x = "Matrix", y = "missing"),
170                    stop("Matrices must have same number of rows for cbind()ing")                function(x, y) x)
171        setMethod("cbind2", signature(x = "NULL", y="Matrix"),
172                  function(x, y) x)
173    
174        ## Makes sure one gets x decent error message for the unimplemented cases:
175        setMethod("cbind2", signature(x = "Matrix", y = "Matrix"),
176                  function(x, y) {
177                      rowCheck(x,y)
178                      stop(gettextf("cbind2() method for (%s,%s) not-yet defined",
179                                    class(x), class(y)))
180                  })
181    
182        if (isGeneric("rbind2"))
183        setMethod("rbind2", signature(x = "Matrix", y = "Matrix"),
184                  function(x, y) {
185                      colCheck(x,y)
186                      stop(gettextf("rbind2() method for (%s,%s) not-yet defined",
187                                    class(x), class(y)))
188            })            })
189    }## R-2.2.x and newer

Legend:
Removed from v.907  
changed lines
  Added in v.908

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