functions that given a data.frame and columns selection in argument 'cols' using tidy selectors, will calculate the mean

bloodpress_mean(data, cols, na.rm = TRUE)

Arguments

data

data frame

cols

columns selected with tidy selectors

na.rm

logical. Should missing values (including NaN) be omitted from the calculations?

Value

numeric vector with mean

See also

Other blood pressure functions: bloodpress_map()

Examples

dt <- data.frame( BloodPress_Diastolic_1 = c(80,32,66,NA), BloodPress_Diastolic_2 = c(58,45,NA,99), BloodPress_Systolic_1 = c(40,NA,80,120), BloodPress_Systolic_2 = c(NA, 65,45,100) ) bloodpress_mean(dt, dplyr::contains("Diastolic"))
#> [1] 69.0 38.5 66.0 99.0
bloodpress_mean(dt, dplyr::contains("Systolic"))
#> [1] 40.0 65.0 62.5 110.0