pullFakeId {EHR}R Documentation

Pull Fake/Mod ID

Description

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

Usage

pullFakeId(
  dat,
  xwalk,
  firstCols = NULL,
  orderBy = NULL,
  uniq.id = "subject_uid"
)

Arguments

dat

a data.frame

xwalk

a data.frame providing linkage for each ID, e.g. output from idCrosswalk

firstCols

name of columns to put at front of output data set

orderBy

name of columns used to reorder output data set

uniq.id

character string indicating subject-level id variable (default is "subject_uid")

Value

The modified data.frame

Examples

demo_data <- data.frame(subj_id=c(4.1,4.2,5.1,6.1),
                        pat_id=c(14872,14872,24308,37143),
                        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))

demo_data_deident <- pullFakeId(demo_data, xwalk, 
                                firstCols = c('mod_id','mod_id_visit','mod_visit'),
                                uniq.id='pat_id')


[Package EHR version 0.4-11 Index]