SCM

SCM Repository

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

Annotation of /pkg/R/Matrix.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1751 - (view) (download)

1 : maechler 607 #### Toplevel ``virtual'' class "Matrix"
2 :    
3 : maechler 1331
4 :     ### Virtual coercions -- via smart "helpers" (-> ./Auxiliaries.R)
5 :    
6 :     setAs("Matrix", "sparseMatrix", function(from) as_Csparse(from))
7 :     setAs("Matrix", "denseMatrix", function(from) as_dense(from))
8 :    
9 : maechler 1618 ## Most of these work; this is a last resort:
10 : maechler 1548 setAs(from = "Matrix", to = "matrix", # do *not* call base::as.matrix() here:
11 :     function(from) .bail.out.2("coerce", class(from), class(to)))
12 : maechler 1618 setAs(from = "matrix", to = "Matrix", function(from) Matrix(from))
13 : maechler 1548
14 : maechler 956 ## ## probably not needed eventually:
15 :     ## setAs(from = "ddenseMatrix", to = "matrix",
16 :     ## function(from) {
17 :     ## if(length(d <- dim(from)) != 2) stop("dim(.) has not length 2")
18 :     ## array(from@x, dim = d, dimnames = dimnames(from))
19 :     ## })
20 : maechler 607
21 : maechler 676 ## should propagate to all subclasses:
22 : maechler 658 setMethod("as.matrix", signature(x = "Matrix"), function(x) as(x, "matrix"))
23 : maechler 956 ## for 'Matrix' objects, as.array() should be equivalent:
24 :     setMethod("as.array", signature(x = "Matrix"), function(x) as(x, "matrix"))
25 : maechler 658
26 : maechler 1347 ## head and tail apply to all Matrix objects for which subscripting is allowed:
27 : maechler 1513 setMethod("head", signature(x = "Matrix"), utils::head.matrix)
28 :     setMethod("tail", signature(x = "Matrix"), utils::tail.matrix)
29 : maechler 1390
30 : maechler 1751 setMethod("drop", signature(x = "Matrix"),
31 :     function(x) if(all(dim(x) != 1)) x else drop(as(x, "matrix")))
32 :    
33 : maechler 956 ## slow "fall back" method {subclasses should have faster ones}:
34 :     setMethod("as.vector", signature(x = "Matrix", mode = "missing"),
35 : maechler 1331 function(x) as.vector(as(x, "matrix")))
36 : maechler 956
37 : maechler 1389 ## mainly need these for "dMatrix" or "lMatrix" respectively, but why not general:
38 :     setMethod("as.numeric", signature(x = "Matrix"),
39 :     function(x, ...) as.numeric(as.vector(x)))
40 :     setMethod("as.logical", signature(x = "Matrix"),
41 :     function(x, ...) as.logical(as.vector(x)))
42 : maechler 956
43 : maechler 1389
44 : maechler 1467 ## "base" has an isSymmetric() S3-generic since R 2.3.0
45 : maechler 1108 setMethod("isSymmetric", signature(object = "symmetricMatrix"),
46 : maechler 973 function(object,tol) TRUE)
47 : maechler 1108 setMethod("isSymmetric", signature(object = "triangularMatrix"),
48 : maechler 1174 ## TRUE iff diagonal:
49 :     function(object,tol) isDiagonal(object))
50 : maechler 1189
51 : maechler 1165 setMethod("isTriangular", signature(object = "triangularMatrix"),
52 : maechler 1238 function(object, ...) TRUE)
53 : maechler 1165
54 : maechler 1238 setMethod("isTriangular", signature(object = "matrix"), isTriMat)
55 :    
56 : maechler 1174 setMethod("isDiagonal", signature(object = "matrix"), .is.diagonal)
57 : maechler 886
58 : maechler 1174
59 :    
60 : maechler 579 setMethod("dim", signature(x = "Matrix"),
61 : maechler 698 function(x) x@Dim, valueClass = "integer")
62 : maechler 1705
63 : maechler 1738 setMethod("length", "Matrix", function(x) prod(dim(x)))
64 :    
65 : maechler 579 setMethod("dimnames", signature(x = "Matrix"), function(x) x@Dimnames)
66 : maechler 1705
67 :    
68 : maechler 607 ## not exported but used more than once for "dimnames<-" method :
69 :     ## -- or do only once for all "Matrix" classes ??
70 :     dimnamesGets <- function (x, value) {
71 :     d <- dim(x)
72 :     if (!is.list(value) || length(value) != 2 ||
73 : maechler 698 !(is.null(v1 <- value[[1]]) || length(v1) == d[1]) ||
74 :     !(is.null(v2 <- value[[2]]) || length(v2) == d[2]))
75 :     stop(sprintf("invalid dimnames given for '%s' object", class(x)))
76 : maechler 607 x@Dimnames <- list(if(!is.null(v1)) as.character(v1),
77 : maechler 698 if(!is.null(v2)) as.character(v2))
78 : maechler 607 x
79 :     }
80 :     setMethod("dimnames<-", signature(x = "Matrix", value = "list"),
81 : maechler 698 dimnamesGets)
82 : maechler 579
83 : maechler 658 setMethod("unname", signature("Matrix", force="missing"),
84 : maechler 698 function(obj) { obj@Dimnames <- list(NULL,NULL); obj})
85 : maechler 607
86 : maechler 1705 setMethod("all", signature(x = "Matrix"),
87 : maechler 1738 function(x, ..., na.rm) { x <- as(x, "lMatrix"); callGeneric()})
88 : maechler 1705 setMethod("any", signature(x = "Matrix"),
89 : maechler 1738 function(x, ..., na.rm) { x <- as(x, "lMatrix"); callGeneric()})
90 : maechler 1705
91 : maechler 1747 setMethod("!", "Matrix", function(e1) !as(e1, "lMatrix"))
92 : maechler 1705
93 :    
94 : maechler 1747
95 : bates 10 Matrix <-
96 : maechler 954 function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL,
97 : maechler 1455 sparse = NULL, forceCheck = FALSE)
98 : bates 10 {
99 : maechler 1665 sparseDefault <- function(m) prod(dim(m)) > 2*sum(isN0(as(m, "matrix")))
100 : maechler 954
101 :     i.M <- is(data, "Matrix")
102 : maechler 1618
103 :     if(is.null(sparse1 <- sparse) && (i.M || is(data, "matrix")))
104 : maechler 1174 sparse <- sparseDefault(data)
105 : maechler 954
106 : maechler 1455 doDN <- TRUE
107 : maechler 1551 if (i.M) {
108 : maechler 1751 if(!missing(nrow) || !missing(ncol)|| !missing(byrow))
109 :     warning("'nrow', 'ncol', etc, are disregarded when 'data' is \"Matrix\" already")
110 : maechler 1174 sM <- is(data,"sparseMatrix")
111 : maechler 1551 if(!forceCheck && ((sparse && sM) || (!sparse && !sM)))
112 : maechler 1174 return(data)
113 :     ## else : convert dense <-> sparse -> at end
114 : maechler 954 }
115 :     else if (!is.matrix(data)) { ## cut & paste from "base::matrix" :
116 : maechler 698 if (missing(nrow))
117 :     nrow <- ceiling(length(data)/ncol)
118 :     else if (missing(ncol))
119 :     ncol <- ceiling(length(data)/nrow)
120 : maechler 1618 if(length(data) == 1 && is0(data) && !identical(sparse, FALSE)) {
121 :     ## Matrix(0, ...) : always sparse unless "sparse = FALSE":
122 :     if(is.null(sparse)) sparse1 <- sparse <- TRUE
123 : maechler 1315 ## will be sparse: do NOT construct full matrix!
124 :     data <- new(if(is.numeric(data)) "dgTMatrix" else
125 :     if(is.logical(data)) "lgTMatrix" else
126 :     stop("invalid 'data'"),
127 :     Dim = as.integer(c(nrow,ncol)),
128 : maechler 1332 Dimnames = if(is.null(dimnames)) list(NULL,NULL)
129 :     else dimnames)
130 : maechler 1315 } else { ## normal case
131 :     data <- .Internal(matrix(data, nrow, ncol, byrow))
132 :     if(is.null(sparse))
133 :     sparse <- sparseDefault(data)
134 :     dimnames(data) <- dimnames
135 :     }
136 : maechler 1455 doDN <- FALSE
137 : maechler 1751 } else if(!missing(nrow) || !missing(ncol)|| !missing(byrow))
138 : maechler 1747 warning("'nrow', 'ncol', etc, are disregarded for matrix 'data'")
139 :    
140 : maechler 1455 ## 'data' is now a "matrix" or "Matrix"
141 :     if (doDN && !is.null(dimnames))
142 : maechler 1189 dimnames(data) <- dimnames
143 : maechler 954
144 : maechler 1174 ## check for symmetric / triangular / diagonal :
145 :     isSym <- isSymmetric(data)
146 :     if((isTri <- !isSym))
147 :     isTri <- isTriangular(data)
148 :     isDiag <- isSym # cannot be diagonal if it isn't symmetric
149 :     if(isDiag)
150 :     isDiag <- isDiagonal(data)
151 :    
152 :     ## Find proper matrix class 'cl'
153 :     cl <-
154 : maechler 1618 if(isDiag && !isTRUE(sparse1))
155 : maechler 1174 "diagonalMatrix" # -> will automatically check for type
156 :     else {
157 :     ## consider it's type
158 :     ctype <-
159 :     if(is(data,"Matrix")) class(data)
160 :     else {
161 :     if("complex" == (ctype <- typeof(data)))
162 :     "z" else ctype
163 :     }
164 :     ctype <- substr(ctype, 1,1) # "d", "l", "i" or "z"
165 :     if(ctype == "z")
166 :     stop("complex matrices not yet implemented in Matrix package")
167 :     if(ctype == "i") {
168 :     warning("integer matrices not yet implemented in 'Matrix'; ",
169 :     "using 'double' ones'")
170 :     ctype <- "d"
171 :     }
172 :     paste(ctype,
173 :     if(sparse) {
174 :     if(isSym) "sCMatrix" else
175 :     if(isTri) "tCMatrix" else "gCMatrix"
176 :     } else { ## dense
177 :     if(isSym) "syMatrix" else
178 :     if(isTri) "trMatrix" else "geMatrix"
179 :     }, sep="")
180 :     }
181 :    
182 :     ## Now coerce and return
183 :     as(data, cl)
184 : bates 10 }
185 :    
186 : bates 683 ## Methods for operations where one argument is numeric
187 : maechler 512
188 : maechler 698 ## Using as.matrix() and rbind()
189 :     ## in order to get dimnames from names {at least potentially}:
190 :    
191 : bates 683 setMethod("%*%", signature(x = "Matrix", y = "numeric"),
192 : maechler 698 function(x, y) callGeneric(x, as.matrix(y)))
193 : bates 683
194 :     setMethod("%*%", signature(x = "numeric", y = "Matrix"),
195 : maechler 1660 function(x, y) callGeneric(matrix(x, nrow = 1, byrow=TRUE), y))
196 : bates 683
197 :     setMethod("crossprod", signature(x = "Matrix", y = "numeric"),
198 : maechler 698 function(x, y = NULL) callGeneric(x, as.matrix(y)))
199 : bates 683 setMethod("crossprod", signature(x = "numeric", y = "Matrix"),
200 : maechler 1331 function(x, y = NULL) callGeneric(as.matrix(x), y))
201 : bates 683
202 : maechler 1331 ## The as.matrix() promotion seems illogical to MM,
203 :     ## but is according to help(tcrossprod, package = "base") :
204 :     setMethod("tcrossprod", signature(x = "Matrix", y = "numeric"),
205 :     function(x, y = NULL) callGeneric(x, as.matrix(y)))
206 :     setMethod("tcrossprod", signature(x = "numeric", y = "Matrix"),
207 :     function(x, y = NULL) callGeneric(as.matrix(x), y))
208 :    
209 : maechler 1665 ## maybe not optimal
210 :     setMethod("solve", signature(a = "Matrix", b = "missing"),
211 :     function(a, b, ...) solve(a, Diagonal(nrow(a))))
212 :    
213 : bates 683 setMethod("solve", signature(a = "Matrix", b = "numeric"),
214 : maechler 698 function(a, b, ...) callGeneric(a, as.matrix(b)))
215 : maechler 1659 ## when no sub-class method is found, bail out
216 :     setMethod("solve", signature(a = "Matrix", b = "matrix"),
217 :     function(a, b, ...) .bail.out.2("solve", class(a), "matrix"))
218 : maechler 1747 setMethod("solve", signature(a = "Matrix", b = "Matrix"),
219 :     function(a, b, ...) .bail.out.2("solve", class(a), class(b)))
220 : maechler 848
221 : maechler 925 ## bail-out methods in order to get better error messages
222 :     setMethod("%*%", signature(x = "Matrix", y = "Matrix"),
223 :     function (x, y)
224 :     stop(gettextf('not-yet-implemented method for <%s> %%*%% <%s>',
225 :     class(x), class(y))))
226 : maechler 946
227 : maechler 925 setMethod("crossprod", signature(x = "Matrix", y = "ANY"),
228 : maechler 946 function (x, y = NULL) .bail.out.2(.Generic, class(x), class(y)))
229 : maechler 956 setMethod("crossprod", signature(x = "ANY", y = "Matrix"),
230 :     function (x, y = NULL) .bail.out.2(.Generic, class(x), class(y)))
231 : maechler 1331 setMethod("tcrossprod", signature(x = "Matrix", y = "ANY"),
232 :     function (x, y = NULL) .bail.out.2(.Generic, class(x), class(y)))
233 :     setMethod("tcrossprod", signature(x = "ANY", y = "Matrix"),
234 :     function (x, y = NULL) .bail.out.2(.Generic, class(x), class(y)))
235 : maechler 925
236 : maechler 1331 ## cheap fallbacks
237 :     setMethod("crossprod", signature(x = "Matrix", y = "Matrix"),
238 :     function(x, y = NULL) t(x) %*% y)
239 :     setMethod("tcrossprod", signature(x = "Matrix", y = "Matrix"),
240 :     function(x, y = NULL) x %*% t(y))
241 :    
242 : maechler 956 ## There are special sparse methods; this is a "fall back":
243 :     setMethod("kronecker", signature(X = "Matrix", Y = "ANY",
244 :     FUN = "ANY", make.dimnames = "ANY"),
245 :     function(X, Y, FUN, make.dimnames, ...) {
246 :     X <- as(X, "matrix") ; Matrix(callGeneric()) })
247 :     setMethod("kronecker", signature(X = "ANY", Y = "Matrix",
248 :     FUN = "ANY", make.dimnames = "ANY"),
249 :     function(X, Y, FUN, make.dimnames, ...) {
250 :     Y <- as(Y, "matrix") ; Matrix(callGeneric()) })
251 :    
252 :    
253 : maechler 1654 ## FIXME: All of these should never be called
254 :     setMethod("chol", signature(x = "Matrix"),
255 :     function(x, pivot = FALSE) .bail.out.1(.Generic, class(x)))
256 :     setMethod("determinant", signature(x = "Matrix"),
257 :     function(x, logarithm = TRUE) .bail.out.1(.Generic, class(x)))
258 :    
259 : maechler 1315 setMethod("diag", signature(x = "Matrix"),
260 :     function(x, nrow, ncol) .bail.out.1(.Generic, class(x)))
261 : maechler 946 setMethod("t", signature(x = "Matrix"),
262 :     function(x) .bail.out.1(.Generic, class(x)))
263 : maechler 925
264 : maechler 956 ## Group Methods
265 :    
266 : maechler 1714 ##-> see ./Ops.R
267 : maechler 1655
268 : maechler 871 ### --------------------------------------------------------------------------
269 :     ###
270 :     ### Subsetting "[" and
271 :     ### SubAssign "[<-" : The "missing" cases can be dealt with here, "at the top":
272 : maechler 868
273 : maechler 886 ## Using "index" for indices should allow
274 : maechler 875 ## integer (numeric), logical, or character (names!) indices :
275 :    
276 : maechler 868 ## "x[]":
277 :     setMethod("[", signature(x = "Matrix",
278 :     i = "missing", j = "missing", drop = "ANY"),
279 :     function (x, i, j, drop) x)
280 : maechler 1225
281 : maechler 868 ## missing 'drop' --> 'drop = TRUE'
282 :     ## -----------
283 :     ## select rows
284 : maechler 886 setMethod("[", signature(x = "Matrix", i = "index", j = "missing",
285 : maechler 868 drop = "missing"),
286 :     function(x,i,j, drop) callGeneric(x, i=i, drop= TRUE))
287 :     ## select columns
288 : maechler 886 setMethod("[", signature(x = "Matrix", i = "missing", j = "index",
289 : maechler 868 drop = "missing"),
290 :     function(x,i,j, drop) callGeneric(x, j=j, drop= TRUE))
291 : maechler 886 setMethod("[", signature(x = "Matrix", i = "index", j = "index",
292 : maechler 868 drop = "missing"),
293 :     function(x,i,j, drop) callGeneric(x, i=i, j=j, drop= TRUE))
294 :    
295 : maechler 875 ## bail out if any of (i,j,drop) is "non-sense"
296 :     setMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY", drop = "ANY"),
297 :     function(x,i,j, drop)
298 :     stop("invalid or not-yet-implemented 'Matrix' subsetting"))
299 :    
300 : maechler 1472 ## logical indexing, such as M[ M >= 7 ] *BUT* also M[ M[,1] >= 3,],
301 :     ## The following is *both* for M [ <logical> ]
302 :     ## and also for M [ <logical> , ]
303 :     .M.sub.i.logical <- function (x, i, j, drop)
304 :     {
305 :     nA <- nargs()
306 :     if(nA == 2) { ## M [ M >= 7 ]
307 : maechler 1673 ## FIXME: when both 'x' and 'i' are sparse, this can be very inefficient
308 : maechler 1472 as(x, geClass(x))@x[as.vector(i)]
309 :     ## -> error when lengths don't match
310 :     } else if(nA == 3) { ## M [ M[,1, drop=FALSE] >= 7, ]
311 :     stop("not-yet-implemented 'Matrix' subsetting") ## FIXME
312 :    
313 :     } else stop("nargs() = ", nA,
314 : maechler 1747 ". Extraneous illegal arguments inside '[ .. ]' ?")
315 : maechler 1472 }
316 : maechler 1225 setMethod("[", signature(x = "Matrix", i = "lMatrix", j = "missing",
317 :     drop = "ANY"),
318 : maechler 1472 .M.sub.i.logical)
319 : maechler 1225 setMethod("[", signature(x = "Matrix", i = "logical", j = "missing",
320 :     drop = "ANY"),
321 : maechler 1472 .M.sub.i.logical)
322 : maechler 1225
323 :    
324 : maechler 1673 ## A[ ij ] where ij is (i,j) 2-column matrix :
325 :     .M.sub.i.2col <- function (x, i, j, drop)
326 :     {
327 :     nA <- nargs()
328 :     if(nA == 2) { ## M [ cbind(ii,jj) ]
329 :     if(!is.integer(nc <- ncol(i)))
330 :     stop("'i' has no integer column number",
331 :     " should never happen; please report")
332 :     if(is.logical(i))
333 :     return(.M.sub.i.logical(x,i,j,drop))
334 :     else if(!is.numeric(i) || nc != 2)
335 :     stop("such indexing must be by logical or 2-column numeric matrix")
336 :     m <- nrow(i)
337 :     if(m == 0) return(vector(mode = .type.kind[.M.kind(x)]))
338 :     ## else
339 :     i1 <- i[,1]
340 :     i2 <- i[,2]
341 :     ## potentially inefficient -- FIXME --
342 :     unlist(lapply(seq_len(m), function(j) x[i1[j], i2[j]]))
343 : maechler 868
344 : maechler 1747 } else stop("nargs() = ", nA,
345 :     ". Extraneous illegal arguments inside '[ .. ]' ?")
346 : maechler 1673 }
347 :     setMethod("[", signature(x = "Matrix", i = "matrix", j = "missing"),# drop="ANY"
348 :     .M.sub.i.2col)
349 : maechler 868
350 : maechler 1472
351 : maechler 871 ### "[<-" : -----------------
352 : maechler 868
353 : maechler 871 ## x[] <- value :
354 :     setReplaceMethod("[", signature(x = "Matrix", i = "missing", j = "missing",
355 : maechler 1189 value = "ANY"),## double/logical/...
356 :     function (x, value) {
357 : maechler 1615 ## Fails for 'nMatrix' ... FIXME : make sure have method there
358 : maechler 1747 x@x <- rep(value, length = length(x@x))
359 : maechler 1615 validObject(x)# check if type and lengths above match
360 :     x
361 : maechler 1189 })
362 : maechler 871
363 : maechler 1673 ## A[ ij ] <- value, where ij is (i,j) 2-column matrix :
364 : maechler 1724 ## ---------------- The cheap general method --- FIXME: provide special ones
365 : maechler 1673 .M.repl.i.2col <- function (x, i, j, value)
366 :     {
367 :     nA <- nargs()
368 :     if(nA == 3) { ## M [ cbind(ii,jj) ] <- value
369 :     if(!is.integer(nc <- ncol(i)))
370 :     stop("'i' has no integer column number",
371 :     " should never happen; please report")
372 : maechler 1724 else if(!is.numeric(i) || nc != 2)
373 :     stop("such indexing must be by logical or 2-column numeric matrix")
374 : maechler 1673 if(is.logical(i)) {
375 : maechler 1738 message(".M.repl.i.2col(): drop 'matrix' case ...")
376 : maechler 1673 i <- c(i) # drop "matrix"
377 :     return( callNextMethod() )
378 : maechler 1724 }
379 :     if(!is.integer(i)) storage.mode(i) <- "integer"
380 :     if(any(i < 0))
381 :     stop("negative values are not allowed in a matrix subscript")
382 :     if(any(is.na(i)))
383 :     stop("NAs are not allowed in subscripted assignments")
384 :     if(any(i0 <- (i == 0))) # remove them
385 :     i <- i[ - which(i0, arr.ind = TRUE)[,"row"], ]
386 :     ## now have integer i >= 1
387 : maechler 1673 m <- nrow(i)
388 : maechler 1724 ## mod.x <- .type.kind[.M.kind(x)]
389 : maechler 1673 if(length(value) > 0 && m %% length(value) != 0)
390 :     warning("number of items to replace is not a multiple of replacement length")
391 :     ## recycle:
392 :     value <- rep(value, length = m)
393 :     i1 <- i[,1]
394 :     i2 <- i[,2]
395 :     ## inefficient -- FIXME -- (also loses "symmetry" unnecessarily)
396 :     for(k in seq_len(m))
397 :     x[i1[k], i2[k]] <- value[k]
398 : maechler 1724
399 : maechler 1673 x
400 : maechler 1747 } else stop("nargs() = ", nA,
401 :     ". Extraneous illegal arguments inside '[ .. ]' ?")
402 : maechler 1673 }
403 : maechler 1724
404 : maechler 1673 setReplaceMethod("[", signature(x = "Matrix", i = "matrix", j = "missing",
405 :     value = "replValue"),
406 :     .M.repl.i.2col)
407 :    
408 :    
409 : maechler 1615 setReplaceMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY",
410 :     value = "Matrix"),
411 : maechler 1705 function (x, i, j, value) {
412 : maechler 1724 ### *TEMPORARY* diagnostic output:
413 :     ## cat("<Matrix1>[i,j] <- <Matrix1>:\n<Matrix1> = x :")
414 :     ## str(x)
415 :     ## cat("<Matrix2> = value :")
416 :     ## str(value)
417 :     ## cat("i :"); if(!missing(i)) str(i) else cat("<missing>\n")
418 :     ## cat("j :"); if(!missing(j)) str(j) else cat("<missing>\n")
419 : maechler 1705
420 :     callGeneric(x=x, i=i, j=j, value = as.vector(value))
421 :     })
422 :     setReplaceMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY",
423 :     value = "Matrix"),
424 : maechler 1615 function (x, i, j, value)
425 :     callGeneric(x=x, i=i, j=j, value = as.vector(value)))
426 : maechler 1705
427 : maechler 1615 setReplaceMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY",
428 :     value = "matrix"),
429 :     function (x, i, j, value)
430 :     callGeneric(x=x, i=i, j=j, value = c(value)))
431 :    
432 : maechler 1189 ## (ANY,ANY,ANY) is used when no `real method' is implemented :
433 : maechler 871 setReplaceMethod("[", signature(x = "Matrix", i = "ANY", j = "ANY",
434 :     value = "ANY"),
435 : maechler 1189 function (x, i, j, value) {
436 :     if(!is.atomic(value))
437 : maechler 1615 stop(sprintf("RHS 'value' (class %s) matches 'ANY', but must match matrix class %s",
438 :     class(value),class(x)))
439 : maechler 1189 else stop("not-yet-implemented 'Matrix[<-' method")
440 :     })

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