SparseArraySeed-utils {DelayedArray} | R Documentation

## Operate natively on SparseArraySeed objects

### Description

Some utilities to operate natively on SparseArraySeed objects. Mostly for internal use by the DelayedArray package e.g. they support block processed methods for sparse DelayedArray objects like `sum()`, `mean()`, `which()`, etc...

### Usage

    ## S4 method for signature 'SparseArraySeed'
    is.na(x)

    ## S4 method for signature 'SparseArraySeed'
    is.infinite(x)

    ## S4 method for signature 'SparseArraySeed'
    is.nan(x)

    ## S4 method for signature 'SparseArraySeed'
    tolower(x)

    ## S4 method for signature 'SparseArraySeed'
    toupper(x)

    ## S4 method for signature 'SparseArraySeed'
    nchar(x, type="chars", allowNA=FALSE, keepNA=NA)

    ## S4 method for signature 'SparseArraySeed'
    anyNA(x, recursive=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    which(x, arr.ind=FALSE, useNames=TRUE)

    ## <>-<>-<> "Summary" group generic <>-<>-<>

    ## S4 method for signature 'SparseArraySeed'
    max(x, ..., na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    min(x, ..., na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    range(x, ..., finite=FALSE, na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    sum(x, ..., na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    prod(x, ..., na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    any(x, ..., na.rm=FALSE)

    ## S4 method for signature 'SparseArraySeed'
    all(x, ..., na.rm=FALSE)

    ## <>-<>-<> others <>-<>-<>

    ## S4 method for signature 'SparseArraySeed'
    mean(x, na.rm=FALSE)

### Arguments

`x` | A SparseArraySeed object.
`type, allowNA, keepNA` | See `?base::nchar` for a description of these arguments.
`recursive` | See `?base::anyNA` for a description of this argument.
`arr.ind` | See `?base::which` for a description of this argument.
`useNames` | Ignored.
`...` | Unsupported.
`na.rm` | `TRUE` or `FALSE` (the default). Should `NA`'s and `NaN`'s be removed?
`finite` | `TRUE` or `FALSE` (the default). Should non-finite values be removed?

### Value

See corresponding functions in the base package.

### See Also

- SparseArraySeed objects.

### Examples

    ## Create a SparseArraySeed object:
    dim1 <- 5:3
    nzindex1 <- Lindex2Mindex(sample(60, 14), 5:3)
    sas1 <- SparseArraySeed(dim1, nzindex1, nzdata=sample(0:13))

    ## Apply native operations:
    sum(sas1)
    range(sas1)
    mean(sas1)

    ## Sanity checks:
    stopifnot(identical(sum(as.array(sas1)), sum(sas1)))
    stopifnot(identical(range(as.array(sas1)), range(sas1)))
    stopifnot(identical(mean(as.array(sas1)), mean(sas1)))

[Package DelayedArray version 0.20.0 Index]