VbetterMax: Vector Better Max

Description Usage Arguments Value Examples

View source: R/VbetterMax.R

Description

Find the element by element max of two vectors

Usage

1
VbetterMax(x, y)

Arguments

x

A numeric vector

y

A numeric vector of the same length as x or of length 1 (if y has length 1, it will be repeated to the length of x)

Value

A numeric vector where each position is the largest value stored in those positions of the input vectors. If both input vectors have NA for a particular position, that position in the output will also contain NA.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ex1 = 6:10
ex2 = (1:5)*3
ex3 = c(1, 10, NA, 6, 2)
ex4 = c(NA, NA, NA, NA, 5)
VbetterMax(ex1, ex2)
VbetterMax(ex1, ex3)
VbetterMax(ex1, ex4)
VbetterMax(ex2, ex3)
VbetterMax(ex2, ex4)
VbetterMax(ex3, ex4)
VbetterMax(ex1, 7)
VbetterMax(ex3, 5)
VbetterMax(ex3, NA)

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