rowCummins: Calculates the cumulative minima for each row (column) of a...

Description Usage Arguments Details Value See Also Examples

Description

Calculates the cumulative minima for each row (column) of a matrix-like object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
rowCummins(x, rows = NULL, cols = NULL, ...)

## S4 method for signature 'matrix_OR_array_OR_table_OR_numeric'
rowCummins(x, rows = NULL, cols = NULL, dim. = dim(x), ...)

## S4 method for signature 'ANY'
rowCummins(x, rows = NULL, cols = NULL, ...)

colCummins(x, rows = NULL, cols = NULL, ...)

## S4 method for signature 'matrix_OR_array_OR_table_OR_numeric'
colCummins(x, rows = NULL, cols = NULL, dim. = dim(x), ...)

## S4 method for signature 'ANY'
colCummins(x, rows = NULL, cols = NULL, ...)

Arguments

x

An NxK matrix-like object.

rows, cols

A vector indicating the subset of rows (and/or columns) to operate over. If NULL, no subsetting is done.

...

Additional arguments passed to specific methods.

dim.

An integer vector of length two specifying the dimension of x, essential when x is a numeric vector. Note, that this is not a generic argument and not all methods need provide it.

Details

The S4 methods for x of type matrix, array, or numeric call matrixStats::rowCummins / matrixStats::colCummins.

Value

Returns a numeric matrixwith the same dimensions as x.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  mat <- matrix(rnorm(15), nrow = 5, ncol = 3)
  mat[2, 1] <- NA
  mat[3, 3] <- Inf
  mat[4, 1] <- 0
  
  print(mat)
  
  rowCummins(mat)
  colCummins(mat)
  

Example output

Loading required package: matrixStats

Attaching package:MatrixGenericsThe following objects are masked frompackage:matrixStats:

    colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
    colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
    colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
    colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
    colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
    colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
    colWeightedMeans, colWeightedMedians, colWeightedSds,
    colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
    rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
    rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
    rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
    rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
    rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
    rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
    rowWeightedSds, rowWeightedVars

           [,1]       [,2]       [,3]
[1,] -0.1336012  1.2364457 -1.1239293
[2,]         NA  0.7794158  1.3018409
[3,]  0.8367800 -0.9983334        Inf
[4,]  0.0000000 -1.5577192 -0.3848734
[5,] -1.0851602  0.9310765 -0.1598716
           [,1]       [,2]       [,3]
[1,] -0.1336012 -0.1336012 -1.1239293
[2,]         NA         NA         NA
[3,]  0.8367800 -0.9983334 -0.9983334
[4,]  0.0000000 -1.5577192 -1.5577192
[5,] -1.0851602 -1.0851602 -1.0851602
           [,1]       [,2]      [,3]
[1,] -0.1336012  1.2364457 -1.123929
[2,]         NA  0.7794158 -1.123929
[3,]         NA -0.9983334 -1.123929
[4,]         NA -1.5577192 -1.123929
[5,]         NA -1.5577192 -1.123929

MatrixGenerics documentation built on Feb. 1, 2021, 2:01 a.m.