vecSum: Adding two vectors with special treatment of NA's.

Description Usage Arguments Value Examples

Description

Addition of two vectors that will ignore NA's if one of the two numbers is NA, but will return NA if both are NA.

Usage

1
vecSum(x, y)

Arguments

x

A numeric vector.

y

A numeric vector.

Value

A numeric vector of the same length as x and y.

Examples

1
2
3
4
5
6
7
8
# create some vectors
x <- c(1,0,NA)
y <- c(1,NA,1)
z <- c(1,2,NA)

# first addition will ignore NA's while second will produce NA
vecSum(x, y)
vecSum(x, z)

hstojic/hfunk documentation built on May 17, 2019, 6:16 p.m.