有了people.createContact,我可以在myContacts中轻松创建联系人。
但是我如何在一个特殊的组中创建联系人?
您可以使用方法 people.createContact创建联系人,就像您可能已经在做的那样。
# this is what Arun does,the actual transformation
d2 <- d[,list(medication = medication[1L],start = date.administered[1L],end = date.administered[.N]),by = rleid(patient,medication)]
# and then we add a group-identifier of the rleid to the old dataset
d[,rleid := .GRP,medication)]
# and then we map those rleids to the ids to the output data
d2[,patient := plyr::mapvalues(rleid,from=d$rleid,to=d$patient)]
看看this示例。