The R Project SVN R-packages

Rev

Rev 4501 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4501 Rev 4743
Line 218... Line 218...
218
    } else stop("index must be numeric or logical for 'sparseVector' indexing")
218
    } else stop("index must be numeric or logical for 'sparseVector' indexing")
219
}
219
}
220
 
220
 
221
 
221
 
222
setMethod("[", signature(x = "sparseVector", i = "index"),
222
setMethod("[", signature(x = "sparseVector", i = "index"),
223
	  function (x, i, j, drop) {
223
	  function (x, i, j, ..., drop) {
224
	      cld <- getClassDef(class(x))
224
	      cld <- getClassDef(class(x))
225
	      has.x <- !extends(cld, "nsparseVector")
225
	      has.x <- !extends(cld, "nsparseVector")
226
	      n <- x@length
226
	      n <- x@length
227
	      ii <- intIv(i, n)
227
	      ii <- intIv(i, n)
228
	      anyDup <- any(iDup <- duplicated(ii))
228
	      anyDup <- any(iDup <- duplicated(ii))
Line 327... Line 327...
327
		 replSPvec)
327
		 replSPvec)
328
 
328
 
329
 
329
 
330
 
330
 
331
## a "method" for c(<(sparse)Vector>, <(sparse)Vector>):
331
## a "method" for c(<(sparse)Vector>, <(sparse)Vector>):
-
 
332
## FIXME: This is not exported, nor used (nor documented)
332
c2v <- function(x, y) {
333
c2v <- function(x, y) {
333
    ## these as(., "sp..V..") check input implicitly:
334
    ## these as(., "sp..V..") check input implicitly:
334
    cx <- class(x <- as(x, "sparseVector"))
335
    cx <- class(x <- as(x, "sparseVector"))
335
    cy <- class(y <- as(y, "sparseVector"))
336
    cy <- class(y <- as(y, "sparseVector"))
336
    if(cx != cy) { ## find "common" class; result does have 'x' slot
337
    if(cx != cy) { ## find "common" class; result does have 'x' slot