colAlls {DelayedMatrixStats} | R Documentation

## Checks if a value exists / does not exist in each row (column) of a matrix

### Description

Checks if a value exists / does not exist in each row (column) of a matrix.

### Usage

    colAlls(x, rows = NULL, cols = NULL, value = TRUE, na.rm = FALSE,
      dim. = dim(x), ...)

    colAnys(x, rows = NULL, cols = NULL, value = TRUE, na.rm = FALSE,
      dim. = dim(x), ...)

    rowAlls(x, rows = NULL, cols = NULL, value = TRUE, na.rm = FALSE,
      dim. = dim(x), ...)

    rowAnys(x, rows = NULL, cols = NULL, value = TRUE, na.rm = FALSE,
      dim. = dim(x), ...)

    ## S4 method for signature 'DelayedMatrix'
    colAlls(x, rows = NULL, cols = NULL,
      value = TRUE, na.rm = FALSE, dim. = dim(x),
      force_block_processing = FALSE, ...)

    ## S4 method for signature 'DelayedMatrix'
    colAnys(x, rows = NULL, cols = NULL,
      value = TRUE, na.rm = FALSE, dim. = dim(x),
      force_block_processing = FALSE, ...)

    ## S4 method for signature 'DelayedMatrix'
    rowAlls(x, rows = NULL, cols = NULL,
      value = TRUE, na.rm = FALSE, dim. = dim(x),
      force_block_processing = FALSE, ...)

    ## S4 method for signature 'DelayedMatrix'
    rowAnys(x, rows = NULL, cols = NULL,
      value = TRUE, na.rm = FALSE, dim. = dim(x),
      force_block_processing = FALSE, ...)

### Arguments

`x` | A NxK DelayedMatrix.
`rows` | A `vector` indicating subset of elements (or rows and/or columns) to operate over. If `NULL`, no subsetting is done.
`cols` | A `vector` indicating subset of elements (or rows and/or columns) to operate over. If `NULL`, no subsetting is done.
`value` | A value to search for.
`na.rm` | If `TRUE`, `NA`s are excluded first, otherwise not.
`dim.` | An `integer` `vector` of length two specifying the dimension of `x`, also when not a `matrix`.
`...` | Additional arguments passed to specific methods.
`force_block_processing` | `FALSE` (the default) means that a seed-aware, optimised method is used (if available). This can be overridden to use the general block-processing strategy by setting this to `TRUE` (typically not advised). The block-processing strategy loads one or more (depending on `getOption("DelayedArray.block.size")`) columns (`colFoo()`) or rows (`rowFoo()`) into memory as an ordinary base::array.

### Details

These functions takes either a matrix or a vector as input. If a vector, then argument `dim.` must be specified and fulfill `prod(dim.) == length(x)`. The result will be identical to the results obtained when passing `matrix(x, nrow = dim.[1L], ncol = dim.[2L])`, but avoids having to temporarily create/allocate a matrix, if only such is needed only for these calculations.

### Value

`rowAlls()` (`colAlls()`) returns an `logical` `vector` of length N (K). Analogously for `rowAnys()` (`rowAlls()`).

### Logical `value`

When `value` is logical, the result is as if the function is applied on `as.logical(x)`. More specifically, if `x` is numeric, then all zeros are treates as `FALSE`, non-zero values as `TRUE`, and all missing values as `NA`.

When `value` is logical, the result is as if the function is applied on `as.logical(x)`. More specifically, if `x` is numeric, then all zeros are treates as `FALSE`, non-zero values as `TRUE`, and all missing values as `NA`.

### See Also

rowCounts

### Examples

    # A DelayedMatrix with a 'matrix' seed
    dm_matrix <- DelayedArray(matrix(c(rep(1L, 5),
                                       as.integer((0:4) ^ 2),
                                       seq(-5L, -1L, 1L)),
                                     ncol = 3))
    # A DelayedMatrix with a 'SolidRleArraySeed' seed
    dm_Rle <- RleArray(Rle(c(rep(1L, 5),
                             as.integer((0:4) ^ 2),
                             seq(-5L, -1L, 1L))),
                       dim = c(5, 3))

    colAlls(dm_matrix, value = 1)
    colAnys(dm_matrix, value = 2)
    rowAlls(dm_Rle, value = 1)
    rowAnys(dm_Rle, value = 2)

[Package DelayedMatrixStats version 1.0.3 Index]