sum_na_rm: A re-coding of the sum function which returns NA if all...

View source: R/sum_na_rm.R

sum_na_rmR Documentation

A re-coding of the sum function which returns NA if all values are NA

Description

A re-coding of the sum function which returns NA if all values are NA. Normally sum(na.rm=TRUE) will return 0 if all values are NA.

Usage

sum_na_rm(x)

Arguments

x

numeric vector

Value

numeric vector of length 1

Examples

sum_na_rm(c(1:2, NA))
sum_na_rm(c(NA, NA))


uclalawcovid19behindbars/behindbarstools documentation built on April 22, 2022, 4:08 a.m.