Learn R Programming

preputils (version 1.0.3)

incons: Detect inconsistencies in 1:1 mapping

Description

In properly normalized data bases, no inconsistencies should be present. In real world data however ID mappings or data base key candidates are repeated over and over across observations, especially in mult centric studies with basic research data. incons tries to detect and flag these mapping discrepanices

Usage

incons(x, y, printproblems=FALSE)

Arguments

x,y

vectors of equal length, holding the mapping values, sepearated by ","

printproblems

Should a table of found problems be printed in addition to the returned flag?

Value

A named vector indicating whether ambiguous mapping does occur (TRUE) or mapping is clean (FALSE)

Details

incons assumes a 1:1 mapping between provided variables, as is commonly the case for example in ID translation steps

Examples

Run this code
# NOT RUN {
    id1 = c(1,2,2,3,4)
    id2 = c("a","b","c","d","d")
    ambiguous <- incons(id1,id2,print=TRUE)
    data.frame(id1,id2,ambiguous)
# }

Run the code above in your browser using DataLab