[R] FW: replace repeated id in a pedigree list
therneau at mayo.edu
Wed Oct 31 18:32:34 CET 2012
> I use kinship package of R and it doesn't create a kinship matrix with repeated id.
The kinship package is out of date, use the kinship2 and coxme packages (it was split into
two parts). Then the problem you describe no longer exists -- the kinship function no
longer requires each subject id to be unique across all pedigrees.
pedlist <- with(mydata, pedgiree(id, fa_id, mo_id, sex, famid=famid))
kmat <- kinship(pedlist)
fit <- coxme(Surv(time, status) ~ x1 + x2 +... + (1| famid/id), varlist=kmat)
The pedlist object contains all the families, plot(pedlist) would pull out and plot the
The column labels of kmat will be of the form "famid/id"
To solve your original problem (though you don't need to) create a single unified id.
uid <- paste(famid, id, sep='/')
idlist <- unique(uid)
newid <- match(uid, idlist)
newmom <- match(paste(famid, mo_id, sep='/'), idlist)
newdad <- match(paste(famid, fa_id, sep='/'), idlist)
author of kinship and coxme, but not :-) the maintainer of kinship2
More information about the R-help