Skip to contents

Compute a row sum and retain NAs when all values in the row are NA.

Usage

mySum(data)

Arguments

data

dataframe

Value

Modified row sum to set row sum to be missing when all values in the row are missing (NA).

Details

Compute a row sum and set the row sum to be missing (not zero) when all values in the row are missing (NA).

See also

Other computations: Mode(), kish_ess(), meanSum()

Examples

# Prepare Data
df <- data.frame(item1 = rnorm(1000), item2 = rnorm(1000), item3 = rnorm(1000))
df[sample(1:nrow(df), size = 100), c("item1","item2","item3")] <- NA

# Calculate Missingness-Adjusted Row Sum
df$sum <- mySum(df)



Developmental Psychopathology Lab