check_unique: Check if the variable has unique answer

Description Usage Arguments Value Examples

View source: R/RecodeR.R

Description

This function is to check if the variable contains unique answer. Return TRUE when it does while return FALSE when it does not. For example, DK (code 98) should exist in a MA question alone; if DK (code 98) exist along with others codes in a MA question, the function will return FALSE.

Usage

1
check_unique(vector, unique_code)

Arguments

vector

variable to be checked

unique_code

specify unique code

Value

vector

Examples

1
check_unique(c("1,2,3", "1,2", "1"), 1)#FALSE FALSE TRUE

momo3246/recode documentation built on Sept. 30, 2020, 2:14 p.m.