sum_dt: A modified sum function

Description Usage Arguments Value Author(s) Examples

View source: R/package_functions.R

Description

Corrects the problem of returning 0 when adding up a vector of all NA's when na.rm = T

Usage

1
sum_dt(x, na.rm = F)

Arguments

x

A vector of numeric values

na.rm

A boolean (T, F) indicator of whether to include NA values or not in the calculation.

Value

A numeric value

Author(s)

Alex Hubbard (hubbard.alex@gmail.com)

Examples

1
2
sum_dt(c(1, 2, NA, 3), na.rm = T)
DT[, sum(col, na.rm = T)]

opendoor-labs/projectmap documentation built on Oct. 8, 2019, 1:58 p.m.