Learn R Programming

eatGADS (version 1.1.1)

checkUniqueness: Check uniqueness of a variable.

Description

Function to check if a variable is unique for all cases of an identifier variable.

Usage

checkUniqueness(GADSdat, varName, idVar)

Value

Returns either TRUE if the variable is unique within each value for idVar or a GADSdat object including the not unique cases.

Arguments

GADSdat

GADSdat object imported via eatGADS.

varName

Single string containing the variable name for which the check should be performed.

idVar

Single string containing the identifier variable name.

Details

For example if missing values are multiple imputed and data is stored in a long format, checking the uniqueness of a variable within an identifier can be tricky. This function automates this task.

Examples

Run this code
## create an example GADSdat
iris2 <- iris
iris2$Species <- as.character(iris2$Species)
gads <- import_DF(iris2, checkVarNames = FALSE)

## check uniqueness
checkUniqueness(gads, varName = "Sepal.Length", idVar = "Species")

Run the code above in your browser using DataLab