Calculate the sum on non-NA values in all columns in the specified direction( 1 == sum all positives, -1 sum absolutes values of negatives)

ehi_values(data, cols = matches("^ehi_[0-9][0-9]$"), direction = 1)

Arguments

data

data.frame containing ehi data

cols

tidy-selection of all ehi columns

direction

sum positive or negatives (1 for positive, -1 for negative)

Value

numeric vector