sum_nonmissing: Calculate sum of non missing values rowwise.

Description Usage Arguments Value Author(s) Examples

View source: R/sum-nonmissing.R

Description

Calculate sum of all non missing values rowwise within mutate function in dplyr package.

Usage

1

Arguments

...

A list of column names from a dataframe for which non-missings are to be calculated rowwise

Value

A an integer value of sum of non-missing values

Author(s)

Som Bohora

Examples

1
2
3
4
5
6
library(magrittr)
iris[c(1,2,4), c(1,3,4)] <- NA
iris %>%
  dplyr::rowwise() %>%  # Notice the use of rowwise here
  dplyr::mutate(Sum.Non.Missings = sum_nonmissing(
  Sepal.Length, Sepal.Width, Petal.Length, Petal.Width))

sbohora/Somya documentation built on May 14, 2019, 7:35 a.m.