pullRealId: Pull Real ID

View source: R/utilsId.R

pullRealIdR Documentation

Pull Real ID

Description

Replace de-identified IDs with identified version pulled from a crosswalk.

Usage

pullRealId(dat, xwalk = NULL, remove.mod.id = FALSE)

Arguments

dat

a data.frame

xwalk

a data.frame providing linkage for each ID, e.g. output from idCrosswalk; if NULL, the crosswalk will be pulled from the ‘pkxwalk’ option, or otherwise the unmodified data.frame.

remove.mod.id

logical, should the de-identified IDs – mod_id, mod_visit, mod_id_visit – be removed (default=FALSE)

Value

The modified data.frame

Examples

demo_data_deident <- data.frame(mod_id=c(1,1,2,3),
                                mod_id_visit=c(1.1,1.2,2.1,3.1),
                                mod_visit=c(1,2,1,1),
                                gender=c(1,1,0,1),
                                weight=c(34,42,28,63),
                                height=c(142,148,120,167))

# crosswalk w/ same format as idCrosswalk() output
xwalk <- data.frame(subj_id=c(4.1,4.2,5.1,6.1),
                    pat_id=c(14872,14872,24308,37143),
                    mod_visit=c(1,2,1,1),
                    mod_id=c(1,1,2,3),
                    mod_id_visit=c(1.1,1.2,2.1,3.1))

pullRealId(demo_data_deident, xwalk)
pullRealId(demo_data_deident, xwalk, remove.mod.id=TRUE)


EHR documentation built on Dec. 28, 2022, 1:31 a.m.