sum.n: Function to limit number of vars with missing values when...

Description Usage Arguments Examples

View source: R/misc.R

Description

Determining the minimum number of variables with valid values in a data frame when calculating row sums.

Usage

1
2
## S3 method for class 'n'
sum(df, n)

Arguments

df

data.frame with numeric variables.

n

number of variables with valid values required for calculating row sums.

Examples

1
2
3
4
5
library(srir)
# all variables must have valid values for raw sums to be calculated, otherwise NA is returned.
sum.n(df.na[-1], 49)
# only 10 variables must have valid values for the sums to be calculated, otherwise NA is returned.
sum.n(df.na[-1], 10)

nrkoehler/srir documentation built on May 23, 2019, 9:03 p.m.