Re: [R] FW: replace repeated id in a pedigree list

2012-10-31 Thread Terry Therneau
> 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 i

[R] FW: replace repeated id in a pedigree list

2012-10-30 Thread Roberta Carriero
From: roberta...@hotmail.it To: smartpink...@yahoo.com Subject: RE: [R] replace repeated id in a pedigree list Date: Tue, 30 Oct 2012 09:51:50 +0100 You are right! I want to "replace the second 6 with a new ID". For example I have id 6 which is repeated 2 times. In family 1 it appears on

Re: [R] FW: replace repeated id in a pedigree list

2012-10-30 Thread Rui Barradas
Hello, Ok, try the following. fun <- function(x, d, last){ new <- last if(any(d)){ ii <- which(d) for(i in ii){ new <- new + 1 old <- x$ID[i] x$ID[i] <- new x$FA_ID[x$FA_ID == old] <- new x$MO_ID[x$MO_ID == old]