Maho Takahashi

Linguistics PhD Student at UC San Diego

research

CV

code

mtakahas[at]ucsd[dot]edu

How to assign unique and de-identified subject IDs

df
##                          ID Age Response
## 1  6080a14dazby884c8399ceb6  24        a
## 2  6080a14dazby884c8399ceb6  34        c
## 3  7d693pp6b5da8a069e4e8f21  42        b
## 4  7d693pp6b5da8a069e4e8f21  52        c
## 5  4h695a065416687501bef3k0   9        a
## 6  4h695a065416687501bef3k0  19        a
## 7  5c41f00cdb78720h0117f1b6  18        b
## 8  5c41f00cdb78720h0117f1b6  28        b
## 9  5e8f9a19645232149jb32a86  34        a
## 10 5e8f9a19645232149jb32a86  44        c

often, online platforms like Prolifics assign workers lengthy IDs. In order to make things look simpler (and de-identify the participants too!), here is a code that I use to convert the IDs to the ones not given by the platforms.

df$ID = as.numeric(factor(df$ID, levels=unique(df$ID)))
df
##    ID Age Response
## 1   1  24        a
## 2   1  34        c
## 3   2  42        b
## 4   2  52        c
## 5   3   9        a
## 6   3  19        a
## 7   4  18        b
## 8   4  28        b
## 9   5  34        a
## 10  5  44        c