M2VbetterMax: Matrix to Vector Better Max

Description Usage Arguments Value Examples

View source: R/VbetterMax.R

Description

Collapse a 2d matrix by taking the betterMax of each row or column

Usage

1
M2VbetterMax(X, MARGIN = 1)

Arguments

X

a numeric matrix

MARGIN

integer of length 1 indicating whether to get the max of each row (1) or column (2)

Value

A numeric vector where each position contains the largest value stored in that row or column of the input matrix. If all values are NA for a particular position, that position in the output will also contain NA.

Examples

1
2
3
4
5
6
ex1 = matrix(c(1:5,NA,1:4,NA,2), 3, 4)
ex2 = matrix(c(5:7,NA,NA,NA), 2, 3)
M2VbetterMax(ex1, 1)
M2VbetterMax(ex1, 2)
M2VbetterMax(ex2, 1)
M2VbetterMax(ex2, 2)

debarros/dbTools documentation built on Sept. 18, 2020, 10:51 a.m.