prop_agree: get (proportion) percentage agreement of answers in a vector...

View source: R/prop_agree.R

prop_agreeR Documentation

get (proportion) percentage agreement of answers in a vector - 'agreement' to be defined by cutoff

Description

get (proportion) percentage agreement of answers in a vector - 'agreement' to be defined by cutoff

Usage

prop_agree(x, cutoff = 1, restrict_level = NULL)

Arguments

x

a numeric vector

cutoff

a vector defining positive answers, default = 1 in a binary dataset

restrict_level

the minimum number of valid answers needed to display result, otherwise the answer is restricted and set to NA, default is NULL (no restriction)

Value

a numeric value between 0 - 1

Examples

# binary vector
vec <- c(0, 1, 1, 0, 0, 1, NA_real_, 1)
prop_agree(x = vec, cutoff = 1)

# with restriction - throws NA as not applicable
prop_agree(x = vec, cutoff = 1, restrict_level = 8)

INS-Basel/hsrtools documentation built on Aug. 3, 2024, 10:15 p.m.