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 2386, Wed May 27 20:54:45 2009 UTC revision 2387, Fri May 29 12:50:34 2009 UTC
# Line 108  Line 108 
108      if (!is.list(value) || length(value) != 2 ||      if (!is.list(value) || length(value) != 2 ||
109          !(is.null(v1 <- value[[1]]) || length(v1) == d[1]) ||          !(is.null(v1 <- value[[1]]) || length(v1) == d[1]) ||
110          !(is.null(v2 <- value[[2]]) || length(v2) == d[2]))          !(is.null(v2 <- value[[2]]) || length(v2) == d[2]))
111          stop(sprintf("invalid dimnames given for '%s' object", class(x)))          stop(gettextf("invalid dimnames given for '%s' object", class(x)))
112      x@Dimnames <- list(if(!is.null(v1)) as.character(v1),      x@Dimnames <- list(if(!is.null(v1)) as.character(v1),
113                         if(!is.null(v2)) as.character(v2))                         if(!is.null(v2)) as.character(v2))
114      x      x
# Line 474  Line 474 
474              ## keep j missing, but  drop = "logical"              ## keep j missing, but  drop = "logical"
475              callGeneric(as(x,"generalMatrix"), i = i, , drop = TRUE)              callGeneric(as(x,"generalMatrix"), i = i, , drop = TRUE)
476    
477      } else stop("nargs() = ", nA,      } else stop(gettextf(
478                  ".  Extraneous illegal arguments inside '[ .. ]' (i.logical)?")                  "nargs() = %d.  Extraneous illegal arguments inside '[ .. ]' (i.logical)?",
479                             nA))
480  }  }
481  setMethod("[", signature(x = "Matrix", i = "lMatrix", j = "missing",  setMethod("[", signature(x = "Matrix", i = "lMatrix", j = "missing",
482                           drop = "ANY"),                           drop = "ANY"),
# Line 559  Line 560 
560          ## else          ## else
561          subset.ij(x, i)          subset.ij(x, i)
562    
563      } else stop("nargs() = ", nA,      } else stop(gettextf(
564                  ".  Extraneous illegal arguments inside '[ .. ]' (i.2col)?")                  "nargs() = %d.  Extraneous illegal arguments inside '[ .. ]' (i.2col)?",
565                             nA))
566  }  }
567  setMethod("[", signature(x = "Matrix", i = "matrix", j = "missing"),# drop="ANY"  setMethod("[", signature(x = "Matrix", i = "matrix", j = "missing"),# drop="ANY"
568            .M.sub.i.2col)            .M.sub.i.2col)
# Line 620  Line 622 
622              x[i1[k], i2[k]] <- value[k]              x[i1[k], i2[k]] <- value[k]
623    
624          x          x
625      } else stop("nargs() = ", nA,      } else stop(gettextf(
626                  ".  Extraneous illegal arguments inside '[ .. ]' ?")                  "nargs() = %d.  Extraneous illegal arguments inside '[ .. ]' ?",
627                             nA))
628  }  }
629    
630  setReplaceMethod("[", signature(x = "Matrix", i = "matrix", j = "missing",  setReplaceMethod("[", signature(x = "Matrix", i = "matrix", j = "missing",
# Line 666  Line 669 
669                                  value = "ANY"),                                  value = "ANY"),
670            function (x, i, j, value) {            function (x, i, j, value) {
671                if(!is.atomic(value))                if(!is.atomic(value))
672                    stop(sprintf("RHS 'value' (class %s) matches 'ANY', but must match matrix class %s",                    stop(gettextf(
673                    "RHS 'value' (class %s) matches 'ANY', but must match matrix class %s",
674                                 class(value),class(x)))                                 class(value),class(x)))
675                else stop("not-yet-implemented 'Matrix[<-' method")                else stop("not-yet-implemented 'Matrix[<-' method")
676            })            })

Legend:
Removed from v.2386  
changed lines
  Added in v.2387

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