get number of agreement answers (defined by a cutoff) in a vector
Arguments
- x
a numeric/integer vector
- cutoff
a vector defining positive answers, default = 1 in a binary dataset
Examples
# usage with dichotomized vector
vec <- c(0, 0, 1, 1, 1)
n_agree(vec)
#> [1] 3
# usage with non-dichotomized vector:
vec <- c(1, 2, 3, 4, 3, 3, 4, 3, 4, 4, NA)
# you need to change the cutoff
n_agree(vec, cutoff = c(3,4))
#> [1] 8