rowSumsProtectNA: Protect rowSums from a row which is all NA; return NA instead...

Description Usage Arguments Value Examples

View source: R/sharedSupport.r

Description

Does essentially what rowSums(., na.rm = T)) does except that it returns NA for any row that is all NA. Uses a matrix oriented approach which is very fast.

Usage

1

Arguments

x

a matrix

Value

the sum of the rows

Examples

1
2
3
4
m <- matrix(c(NA), ncol = 6, nrow = 1)
m
rowSums(m, na.rm = T)
rowSumsProtectNA(m)

jasonelaw/nrsa documentation built on Nov. 8, 2019, 11:34 a.m.