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

Rui Barradas ruipbarradas at sapo.pt
Tue Oct 30 12:58:52 CET 2012


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] <- new
         }
     } else new <- FALSE
     list(new = new, DF = x)
}

lastid <- nrow(dat)
idx <- duplicated(dat$ID)
sp <- split(dat, dat$FAMID)
dup <- split(idx, dat$FAMID)
result <- vector("list", length(sp))

for(i in seq_along(sp)){
     ret <- fun(sp[[i]], dup[[i]], lastid)
     result[[i]] <- ret$DF
     if(ret$new) lastid <- ret$new
}
d2 <- do.call(rbind, result)
# check (should be zero)
sum(duplicated(d2$ID))


Hope this helps,

Rui Barradas
Em 30-10-2012 11:22, Roberta Carriero escreveu:
>
>
> From: robertacar at hotmail.it
> To: smartpink111 at 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 one time. In family 37 I should replace id 6 with a new id whenever it appears, not only as founder but also as father. It is important to use a new id which doesn't exist in all the pedigrees belonging to the "Pedigree.txt" file. Thank you for help RegardsRoberta
>
> FAMID    ID    FA ID    MO ID    SEX    STATUS> 1    1    0    0    2    0> 1    2    3    1    2    2> 1    4    3    1    1    2> 1    5    3    1    1    0> 1    6    3    1    1    0> 1    7    3    1    2    2> 1    8    3    1    1    0> 1    9    3    1    1    0> 1    10    3    1    2    0> 1    11    3    1    1    0> 1    3    0    0    1    0 37    277    0    0    2    0> 37    546    547    548    2    2> 37    549    547    548    1    2> 37    550    6    551    1    0> 37    551    552    553    2    2> 37    552    554    555    1    0> 37    556    0    0    2    0> 37    557    6    551    2    0> 37    558    6    551    2    2> 37    559    6    551    1    0> 37    560    6    551    1    2> 37    6    0    0    1    0> 37    554    0    0    1    0> 37    561    554    562    1    0> 37    562    0    0    2    0> 37    555    0    0    2    0> 37    563    521    558    1    0> 37    306    0    0    1    0> 37    521    306    307    1    2> 37    564    521    558    2    2> 37    565    521    558    1    2> 37    307    0    0    2    2> 37    566    6    551    1    0> 37    548    6    551    2    2> 37    567    6    551    2    2> 37    568    561    556    1    0> 37    547    568    277    1    0> 37    553    0    0    2    0> Date: Mon, 29 Oct 2012 20:23:56 -0700
>> From: smartpink111 at yahoo.com
>> Subject: Re: [R] replace repeated id in a pedigree list
>> To: robertacar at hotmail.it
>>
>> Hi,
>>
>> I am a bit confused by this statement
>> "I want to replace repeated individual identifiers with new id and to
>> replace them not only in id column but also in father and mother id
>> columns"
>>
>> In the dataset, you have repeated identifiers for ID, FAID and MOID.
>>
>> For eg.
>> source("Pedigree.txt")
>>   head(dat1)
>> #  FAMID ID FAID MOID SEX STATUS
>> #1     1  1    0    0   2      0
>> #2     1  2    3    1   2      2
>> #3     1  4    3    1   1      2
>> #4     1  5    3    1   1      0
>> #5     1  6    3    1   1      0
>> #6     1  7    3    1   2      2
>>
>> dat2<-dat1[duplicated(dat1$ID)|duplicated(dat1$ID,fromLast=TRUE),]
>> dat3<-dat2[order(dat2$ID),]
>>   head(dat3)
>> #    FAMID ID FAID MOID SEX STATUS
>> #5       1  6    3    1   1      0
>> #603    37  6    0    0   1      0
>> #17      2 20    0    0   1      0
>> #469    29 20    0    0   1      0
>> #21      2 24   12   16   1      0
>> #533    32 24    0    0   1      0
>>   dat1$ID[duplicated(dat1$ID)|duplicated(dat1$ID,fromLast=TRUE)]
>> #  [1]   6  20  24  29  30  31  47  62  63  95  96  99 100  93 101 102  83 105
>>   #[19] 107 112 113 115 117 108 142 155 146 157 161  96 167 177 105 107 192 108
>>   #[37] 203 204 113 212 221 228 229 107 236 239 223 155 146 251 157 258 260 257
>>   #[55] 256 277 279 212 260  83 288 296 251 294 306 303 307 296 328 339 328 342
>>   #[73] 333 338 345 258 177 257 192 256 382 378 377 167 404 410 203 204 413 113
>>   #[91] 422 115 426 427 117 411 412 434 435  20  29 449  30  31 450 404 464 479
>> #[109] 480 481 413 483 484 434 476 477  47 288  24 506 500 501 339 328 516 294
>> #[127] 306 521 303 333 307 516 306 543 545 307 277   6 306 521 307 112 506 500
>> #[145] 501 596 598 599 598  62  63 229 236 239 627 619 620 599 638 645 650 651
>> #[163] 643 642 646 653  95  99 100 663  93 101 638 674 464 411 645 650 671 412
>> #[181] 651 672 646 696 686 685 411 671 378 377 412 672 653 733 435 760 650 651
>> #[199] 643 642 686 102 685 221 228 101 223 480 142 481 382 733 596 161 476 477
>> #[217] 696 627 674 760 645 650 651 619 646 620 239 410 422 426 427 479 483 484
>> #[235] 663  29 449 545  31 450 279 177 342 943 947 192 949 338 345 945 944 177
>> #[253] 543 943 947 192 949 945 944 410 333 427
>>
>> #The same way you can get the repeated FAID and MOID
>> dat1$FAID[duplicated(dat1$FAID)|duplicated(dat1$FAID,fromLast=TRUE)]
>> dat1$MOID[duplicated(dat1$MOID)|duplicated(dat1$MOID,fromLast=TRUE)]
>>
>>  From the dat3 IDs, you have 6 repeated 2 times.  In that case, you want to replace the second 6 with a new ID.   Regarding the new ID, will it work if that ID is already present in FAID or MOID?
>> A.K.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ----- Original Message -----
>> From: Roberta Carriero <robertacar at hotmail.it>
>> To: r-help at r-project.org
>> Cc:
>> Sent: Monday, October 29, 2012 2:08 PM
>> Subject: [R] replace repeated id in a pedigree list
>>
>>
>> Hello,
>> I have a pedigree file such this:
>> FAMID    ID    FA ID    MO ID    SEX    STATUS
>> 1    1    0    0    2    0
>> 1    2    3    1    2    2
>> 1    4    3    1    1    2
>> 1    5    3    1    1    0
>> 1    6    3    1    1    0
>> 1    7    3    1    2    2
>> 1    8    3    1    1    0
>> 1    9    3    1    1    0
>> 1    10    3    1    2    0
>> 1    11    3    1    1    0
>> 1    3    0    0    1    0
>> 2    12    13    14    1    0
>> 2    15    12    16    2    0
>> 2    17    12    16    1    0
>> 2    18    12    16    1    0
>> 2    19    12    16    1    0
>> 2    20    0    0    1    0
>> 2    21    0    0    2    0
>> 2    22    12    16    2    2
>> 2    23    12    16    1    0
>> 2    24    12    16    1    0
>> 2    25    12    16    1    0
>> 2    26    12    16    2    0
>> 2    27    28    21    2    2
>> 2    29    0    0    2    0
>> 2    14    0    0    2    0
>> 2    30    31    29    2    0
>> 2    13    31    29    1    0
>> 2    31    0    0    1    0
>> 2    28    20    30    1    0
>> 2    32    28    21    2    2
>> 2    16    0    0    2    0
>> 3    33    34    35    2    0
>> 3    35    0    0    2    0
>> 3    36    34    35    1    0
>> 3    37    34    35    1    0
>> 3    38    34    35    2    0
>> 3    39    34    35    1    0
>> 3    40    34    35    2    0
>> 3    41    34    35    2    0
>> 3    42    34    35    2    2
>> 3    43    34    35    1    0
>> 3    34    0    0    1    0
>> 3    44    34    35    2    0
>> 3    45    34    35    1    2
>> 4    46    47    48    2    2
>> 4    49    47    48    1    0
>> 4    50    47    48    1    0
>> 4    51    47    48    2    0
>> 4    47    0    0    1    0
>> 4    52    47    48    1    2
>> 4    53    47    48    2    2
>> 4    48    0    0    2    2
>> 4    54    47    48    2    2
>> 4    55    47    48    2    2
>> 5    56    57    58    1    0
>> 5    59    60    61    2    2
>> 5    60    62    63    1    2
>> 5    62    0    0    1    0
>> 5    63    0    0    2    2
>> 5    57    0    0    1    0
>> 5    64    57    58    1    0
>> 5    65    60    61    2    2
>> 5    66    57    58    1    0
>> 5    67    68    69    2    2
>> 5    70    68    69    1    0
>> 5    71    68    69    2    2
>> 5    68    0    0    1    0
>> 5    72    57    58    1    0
>> 5    61    57    58    2    2
>> 5    73    57    58    1    0
>> 5    74    57    58    2    0
>> 5    75    60    61    2    2
>> 5    76    57    58    1    0
>> 5    69    57    58    2    2
>> 5    77    57    58    2    2
>> 5    78    0    0    1    0
>> 5    58    0    0    2    0
>> 5    79    78    77    2    2
>> 5    80    78    77    2    2
>> 5    81    78    77    1    0
>> 6    82    83    84    1    0
>> 6    85    83    84    1    0
>> 6    86    0    0    1    2
>> 6    87    86    88    1    0
>> 6    89    86    88    1    0
>> 6    90    86    88    2    0
>> 6    91    86    88    2    2
>> 6    92    87    93    2    2
>> 6    94    86    88    2    2
>> 6    84    0    0    2    0
>> 6    95    0    0    2    0
>> 6    96    83    84    1    0
>> 6    97    83    84    1    0
>> 6    98    83    84    2    0
>> 6    99    0    0    1    2
>> 6    100    99    95    2    0
>> 6    93    101    100    2    0
>> 6    101    0    0    1    0
>> 6    102    83    84    2    0
>> 6    88    83    84    2    2
>> 6    83    0    0    1    0
>> 6    103    83    84    1    0
>> 7    104    105    106    1    0
>> 7    105    107    108    1    0
>> 7    107    0    0    1    0
>> 7    109    105    106    2    2
>> 7    110    111    112    1    0
>> 7    112    0    0    2    2
>> 7    113    0    0    2    2
>> 7    114    115    116    1    2
>> 7    115    117    113    1    0
>> 7    118    115    116    1    2
>> 7    119    115    116    1    0
>> 7    117    0    0    1    2
>> 7    108    0    0    2    2
>> 7    116    111    112    2    2
>> 7    120    111    112    1    0
>> 7    106    111    112    2    2
>> 7    111    0    0    1    0
>> 7    121    105    106    2    2
>> 8    122    123    124    2    0
>> 8    125    123    124    1    0
>> 8    126    123    124    1    0
>> 8    127    123    124    1    0
>> 8    128    123    124    1    2
>> 8    129    123    124    1    0
>> 8    130    123    124    1    0
>> 8    131    123    124    2    0
>> 8    123    0    0    1    0
>> 8    124    0    0    2    0
>> 8    132    123    124    2    2
>> 9    133    134    135    2    0
>> 9    136    137    133    1    0
>> 9    138    137    133    2    0
>> 9    137    139    140    1    0
>> 9    141    139    140    1    0
>> 9    142    0    0    1    0
>> 9    143    137    133    2    2
>> 9    144    145    146    2    2
>> 9    145    147    148    1    0
>> 9    149    145    146    2    0
>> 9    150    145    146    2    0
>> 9    151    137    133    2    0
>> 9    152    137    133    1    0
>> 9    153    137    133    1    2
>> 9    148    0    0    2    0
>> 9    154    137    133    1    0
>> 9    155    141    156    2    0
>> 9    146    157    155    2    0
>> 9    157    0    0    1    0
>> 9    158    145    146    1    0
>> 9    159    145    146    1    0
>> 9    160    0    0    1    0
>> 9    161    160    162    2    0
>> 9    135    160    162    2    0
>> 9    134    0    0    1    0
>> 9    162    0    0    2    0
>> 9    140    0    0    2    0
>> 9    139    0    0    1    0
>> 9    156    0    0    2    0
>> 9    147    142    161    1    0
>> 10    163    96    164    2    2
>> 10    165    96    164    1    2
>> 10    164    166    167    2    2
>> 10    168    166    167    1    0
>> 10    169    166    167    1    0
>> 10    166    0    0    1    0
>> 10    170    166    167    2    0
>> 10    96    0    0    1    0
>> 10    171    96    164    2    2
>> 10    167    0    0    2    2
>> 10    172    166    167    2    0
>> 10    173    166    167    1    0
>> 10    174    166    167    2    0
>> 11    175    0    0    2    0
>> 11    176    107    108    2    0
>> 11    177    0    0    2    0
>> 11    178    107    108    2    2
>> 11    179    180    181    1    0
>> 11    182    183    178    2    0
>> 11    184    107    108    1    0
>> 11    185    183    178    1    2
>> 11    186    180    181    2    2
>> 11    187    180    181    1    2
>> 11    183    180    181    1    2
>> 11    188    183    178    2    2
>> 11    105    107    108    1    0
>> 11    107    0    0    1    0
>> 11    189    0    0    2    0
>> 11    190    0    0    2    0
>> 11    191    107    108    1    0
>> 11    192    193    189    1    0
>> 11    194    193    189    1    0
>> 11    193    0    0    1    0
>> 11    108    195    175    2    2
>> 11    196    180    181    1    0
>> 11    197    180    181    1    0
>> 11    198    180    181    1    0
>> 11    199    180    181    2    0
>> 11    180    0    0    1    0
>> 11    195    192    177    1    0
>> 11    181    194    190    2    0
>> 12    200    201    202    1    0
>> 12    203    0    0    2    0
>> 12    204    0    0    1    0
>> 12    205    201    202    2    2
>> 12    201    0    0    1    0
>> 12    206    204    203    2    0
>> 12    207    204    203    1    0
>> 12    202    204    203    2    2
>> 12    113    204    203    2    2
>> 12    208    204    203    2    0
>> 12    209    204    203    1    0
>> 12    210    204    203    1    0
>> 13    211    212    213    2    0
>> 13    213    0    0    2    0
>> 13    214    212    213    1    2
>> 13    212    0    0    1    0
>> 13    215    212    213    1    0
>> 13    216    212    213    2    2
>> 13    217    212    213    1    0
>> 13    218    212    213    2    0
>> 13    219    212    213    1    0
>> 13    220    212    213    1    0
>> 14    221    0    0    2    0
>> 14    222    223    221    1    0
>> 14    224    223    221    1    0
>> 14    225    223    221    1    0
>> 14    226    223    221    1    0
>> 14    227    223    221    2    0
>> 14    228    223    221    2    0
>> 14    229    0    0    2    0
>> 14    230    0    0    2    2
>> 14    231    223    221    2    0
>> 14    232    233    230    1    2
>> 14    234    233    230    1    0
>> 14    107    223    221    1    0
>> 14    235    234    236    2    2
>> 14    237    233    230    1    2
>> 14    238    234    236    1    0
>> 14    236    239    229    2    0
>> 14    239    0    0    1    2
>> 14    240    223    221    1    0
>> 14    241    233    230    1    0
>> 14    233    223    221    1    2
>> 14    223    0    0    1    0
>> 15    242    157    155    2    0
>> 15    243    157    155    2    0
>> 15    244    245    246    1    2
>> 15    247    245    246    1    2
>> 15    248    157    155    1    0
>> 15    249    157    155    1    0
>> 15    155    0    0    2    0
>> 15    250    157    155    2    0
>> 15    146    157    155    2    0
>> 15    251    157    155    1    2
>> 15    157    0    0    1    0
>> 15    246    157    155    2    2
>> 15    252    157    155    2    0
>> 15    253    245    246    1    0
>> 15    254    245    246    1    0
>> 15    245    0    0    1    0
>> 16    255    256    257    2    0
>> 16    258    256    257    2    0
>> 16    259    256    257    2    0
>> 16    260    256    257    1    0
>> 16    261    256    257    2    2
>> 16    262    256    257    1    0
>> 16    263    256    257    1    0
>> 16    264    256    257    1    0
>> 16    265    256    257    1    0
>> 16    266    256    257    2    0
>> 16    267    0    0    2    2
>> 16    257    0    0    2    0
>> 16    268    0    0    1    0
>> 16    269    270    267    1    2
>> 16    270    268    261    1    2
>> 16    271    268    261    1    0
>> 16    256    0    0    1    0
>> 16    272    270    267    2    2
>> 17    273    274    275    1    0
>> 17    276    274    275    2    0
>> 17    277    274    275    2    0
>> 17    278    274    275    2    0
>> 17    279    274    275    2    0
>> 17    212    274    275    1    0
>> 17    280    260    281    2    2
>> 17    260    0    0    1    0
>> 17    281    274    275    2    2
>> 17    275    0    0    2    0
>> 17    83    274    275    1    0
>> 17    282    260    281    2    2
>> 17    274    0    0    1    0
>> 18    283    284    285    1    0
>> 18    286    284    285    1    0
>> 18    285    0    0    2    0
>> 18    284    0    0    1    0
>> 18    287    284    285    1    2
>> 18    288    284    285    2    2
>> 18    289    284    285    1    0
>> 18    290    284    285    2    0
>> 18    291    284    285    2    0
>> 19    292    293    294    1    0
>> 19    293    0    0    1    2
>> 19    295    296    297    2    2
>> 19    298    293    294    1    0
>> 19    299    296    297    1    2
>> 19    297    293    294    2    2
>> 19    300    293    294    1    0
>> 19    296    0    0    1    2
>> 19    301    296    297    2    2
>> 19    302    251    303    2    2
>> 19    251    0    0    1    2
>> 19    304    251    303    1    2
>> 19    305    251    303    1    2
>> 19    294    306    307    2    2
>> 19    306    0    0    1    0
>> 19    303    306    307    2    2
>> 19    307    0    0    2    2
>> 20    308    309    310    2    2
>> 20    310    0    0    2    0
>> 20    311    309    310    1    2
>> 20    312    309    310    1    0
>> 20    296    309    310    1    2
>> 20    313    309    310    2    2
>> 20    309    0    0    1    0
>> 20    314    315    313    2    2
>> 20    316    315    313    1    2
>> 20    315    0    0    1    0
>> 20    317    309    310    1    0
>> 21    318    319    320    2    2
>> 21    319    0    0    1    0
>> 21    320    0    0    2    2
>> 22    321    322    323    2    0
>> 22    324    322    323    2    0
>> 22    325    322    323    1    2
>> 22    326    322    323    2    2
>> 22    327    322    323    1    2
>> 22    328    322    323    1    0
>> 22    329    322    323    2    0
>> 22    330    322    323    2    2
>> 22    331    322    323    1    0
>> 22    322    0    0    1    0
>> 22    323    0    0    2    0
>> 23    332    328    333    2    0
>> 23    334    328    333    1    0
>> 23    335    328    333    1    0
>> 23    336    337    338    2    2
>> 23    339    328    333    2    2
>> 23    340    328    333    1    2
>> 23    341    328    333    1    2
>> 23    337    328    333    1    2
>> 23    328    0    0    1    0
>> 23    342    0    0    2    2
>> 23    343    337    338    1    2
>> 23    344    328    333    1    0
>> 23    333    0    0    2    2
>> 23    338    345    342    2    2
>> 23    345    0    0    1    0
>> 24    346    347    348    1    0
>> 24    349    347    348    1    0
>> 24    350    347    348    2    0
>> 24    351    347    348    1    0
>> 24    352    347    348    2    0
>> 24    347    0    0    1    0
>> 24    258    256    257    2    0
>> 24    353    347    348    2    0
>> 24    177    354    355    2    0
>> 24    356    357    358    1    0
>> 24    357    359    360    1    2
>> 24    361    359    360    1    0
>> 24    362    357    358    1    2
>> 24    359    363    258    1    2
>> 24    364    359    360    1    2
>> 24    365    359    360    1    2
>> 24    366    359    360    2    2
>> 24    367    347    348    2    2
>> 24    368    347    348    1    0
>> 24    369    347    348    1    0
>> 24    370    347    348    2    0
>> 24    371    357    358    2    2
>> 24    360    0    0    2    2
>> 24    358    0    0    2    2
>> 24    257    354    355    2    0
>> 24    354    0    0    1    0
>> 24    355    0    0    2    0
>> 24    192    0    0    1    0
>> 24    256    0    0    1    0
>> 24    372    359    360    2    0
>> 24    363    0    0    1    0
>> 24    348    192    177    2    0
>> 25    373    374    375    2    0
>> 25    376    377    378    2    0
>> 25    379    380    376    2    2
>> 25    375    0    0    2    0
>> 25    380    0    0    1    0
>> 25    381    380    376    2    2
>> 25    382    0    0    1    0
>> 25    383    384    385    1    2
>> 25    386    382    387    2    2
>> 25    388    382    387    2    0
>> 25    384    382    387    1    2
>> 25    389    382    387    1    0
>> 25    390    380    376    1    0
>> 25    391    392    381    1    0
>> 25    393    0    0    2    0
>> 25    385    392    381    2    2
>> 25    392    394    373    1    0
>> 25    395    0    0    1    0
>> 25    378    0    0    2    0
>> 25    377    395    393    1    0
>> 25    374    395    393    1    0
>> 25    387    0    0    2    0
>> 25    396    380    376    2    2
>> 25    397    380    376    1    0
>> 25    398    380    376    2    2
>> 25    394    0    0    1    0
>> 26    399    400    401    2    0
>> 26    167    400    401    2    2
>> 26    402    400    401    2    2
>> 26    403    400    401    1    0
>> 26    404    400    401    1    2
>> 26    405    400    401    2    0
>> 26    401    0    0    2    0
>> 26    400    0    0    1    0
>> 27    406    407    408    1    0
>> 27    409    407    408    1    0
>> 27    410    0    0    2    0
>> 27    203    0    0    2    0
>> 27    204    411    412    1    0
>> 27    413    0    0    2    2
>> 27    414    415    416    2    0
>> 27    407    0    0    1    0
>> 27    417    407    408    2    2
>> 27    418    407    408    1    2
>> 27    419    407    408    1    2
>> 27    420    419    413    1    2
>> 27    421    419    413    2    0
>> 27    113    204    203    2    2
>> 27    422    0    0    2    0
>> 27    408    423    424    2    0
>> 27    115    117    113    1    0
>> 27    425    415    416    1    2
>> 27    426    0    0    1    0
>> 27    423    426    422    1    0
>> 27    427    426    422    1    0
>> 27    415    117    113    1    2
>> 27    428    117    113    1    0
>> 27    117    427    410    1    2
>> 27    411    0    0    1    0
>> 27    429    0    0    1    0
>> 27    430    411    412    2    0
>> 27    412    0    0    2    0
>> 27    416    431    417    2    2
>> 27    431    0    0    1    2
>> 27    432    117    113    2    0
>> 27    424    429    430    2    0
>> 28    433    434    435    2    0
>> 28    436    434    435    1    2
>> 28    434    0    0    1    2
>> 28    435    0    0    2    2
>> 29    437    438    439    1    0
>> 29    440    0    0    1    0
>> 29    441    440    442    2    2
>> 29    443    440    442    1    2
>> 29    444    440    442    1    0
>> 29    445    440    442    2    0
>> 29    20    0    0    1    0
>> 29    442    438    439    2    2
>> 29    438    446    447    1    0
>> 29    448    440    442    1    0
>> 29    447    0    0    2    0
>> 29    29    0    0    2    0
>> 29    449    0    0    2    0
>> 29    30    31    29    2    0
>> 29    31    450    449    1    0
>> 29    446    450    449    1    0
>> 29    450    0    0    1    0
>> 29    439    20    30    2    0
>> 30    451    404    452    2    0
>> 30    453    404    452    1    0
>> 30    454    404    452    2    0
>> 30    455    404    452    1    0
>> 30    456    457    458    1    2
>> 30    459    457    458    1    2
>> 30    457    404    452    1    2
>> 30    460    404    452    1    0
>> 30    404    0    0    1    2
>> 30    461    404    452    2    0
>> 30    462    463    464    1    2
>> 30    465    463    464    2    0
>> 30    466    404    452    1    0
>> 30    464    0    0    2    2
>> 30    458    463    464    2    2
>> 30    463    0    0    1    0
>> 30    452    0    0    2    2
>> 30    467    463    464    1    0
>> 30    468    463    464    1    0
>> 31    469    0    0    1    0
>> 31    470    469    471    2    0
>> 31    472    469    471    1    0
>> 31    473    469    471    2    0
>> 31    474    469    471    1    0
>> 31    471    0    0    2    0
>> 31    475    476    477    1    0
>> 31    478    476    477    2    2
>> 31    479    476    477    2    2
>> 31    480    476    477    1    2
>> 31    481    476    477    2    2
>> 31    482    476    477    2    2
>> 31    413    476    477    2    2
>> 31    483    484    479    2    2
>> 31    485    469    471    1    2
>> 31    484    469    471    1    2
>> 31    434    469    471    1    2
>> 31    486    484    479    2    2
>> 31    487    469    471    1    0
>> 31    476    0    0    1    0
>> 31    477    0    0    2    0
>> 32    488    489    490    1    0
>> 32    490    0    0    2    0
>> 32    489    0    0    1    0
>> 32    491    489    490    1    2
>> 32    492    493    494    2    2
>> 32    493    0    0    1    0
>> 32    47    489    490    1    0
>> 32    494    489    490    2    2
>> 32    288    0    0    2    2
>> 32    495    24    288    1    2
>> 32    496    24    288    1    0
>> 32    497    24    288    1    2
>> 32    24    0    0    1    0
>> 32    498    497    492    2    2
>> 33    499    500    501    1    0
>> 33    502    500    501    2    2
>> 33    503    500    501    1    0
>> 33    504    500    501    2    2
>> 33    505    500    501    2    2
>> 33    506    500    501    1    0
>> 33    500    0    0    1    0
>> 33    501    0    0    2    0
>> 34    507    306    307    1    0
>> 34    508    306    307    1    0
>> 34    509    306    307    2    0
>> 34    510    511    512    2    2
>> 34    511    0    0    1    2
>> 34    513    511    512    1    2
>> 34    514    511    512    1    2
>> 34    339    328    333    2    2
>> 34    328    0    0    1    0
>> 34    515    306    307    1    0
>> 34    516    306    307    1    2
>> 34    517    306    307    1    0
>> 34    518    519    339    1    0
>> 34    294    306    307    2    2
>> 34    306    0    0    1    0
>> 34    520    519    339    1    2
>> 34    521    306    307    1    2
>> 34    512    306    307    2    2
>> 34    522    519    339    2    2
>> 34    523    519    339    1    0
>> 34    519    306    307    1    2
>> 34    524    519    339    1    2
>> 34    303    306    307    2    2
>> 34    333    0    0    2    2
>> 34    307    0    0    2    2
>> 35    525    0    0    1    2
>> 35    526    525    527    1    2
>> 35    528    525    527    1    0
>> 35    527    0    0    2    2
>> 36    529    0    0    2    2
>> 36    530    0    0    1    2
>> 36    531    530    532    1    0
>> 36    533    530    532    1    2
>> 36    534    530    532    1    0
>> 36    535    530    532    1    2
>> 36    536    530    532    2    2
>> 36    532    537    529    2    2
>> 36    538    537    529    2    2
>> 36    537    0    0    1    2
>> 36    516    306    307    1    2
>> 36    539    540    536    1    2
>> 36    541    516    538    2    2
>> 36    306    0    0    1    0
>> 36    542    516    538    1    2
>> 36    543    0    0    1    2
>> 36    544    543    545    2    2
>> 36    540    543    545    1    2
>> 36    545    0    0    2    2
>> 36    307    0    0    2    2
>>
>> 38    569    570    571    2    0
>> 38    572    570    571    1    0
>> 38    573    570    571    2    0
>> 38    570    0    0    1    0
>> 38    574    570    571    2    0
>> 38    575    570    571    1    0
>> 38    112    570    571    2    2
>> 38    576    570    571    2    2
>> 38    571    0    0    2    0
>> 39    577    578    579    2    0
>> 39    580    578    579    1    0
>> 39    581    578    579    1    2
>> 39    582    578    579    2    0
>> 39    578    583    584    1    0
>> 39    585    0    0    1    0
>> 39    579    0    0    2    0
>> 39    506    500    501    1    0
>> 39    586    578    579    2    2
>> 39    587    506    586    2    2
>> 39    588    578    579    2    2
>> 39    500    585    589    1    0
>> 39    583    585    589    1    0
>> 39    589    0    0    2    0
>> 39    584    0    0    2    0
>> 39    501    0    0    2    0
>> 40    590    591    592    1    0
>> 40    593    591    592    2    0
>> 40    594    591    592    1    0
>> 40    595    591    592    1    2
>> 40    596    591    592    1    2
>> 40    591    0    0    1    0
>> 40    592    0    0    2    0
>> 41    597    598    599    2    0
>> 41    600    598    599    2    0
>> 41    601    598    599    2    0
>> 41    598    0    0    1    0
>> 41    602    598    599    1    0
>> 41    603    598    599    1    2
>> 41    604    598    599    2    0
>> 41    599    0    0    2    2
>> 42    605    606    607    2    0
>> 42    608    606    607    1    2
>> 42    609    606    607    2    0
>> 42    610    606    607    2    0
>> 42    607    0    0    2    0
>> 42    598    606    607    1    0
>> 42    611    606    607    1    0
>> 42    612    606    607    2    2
>> 42    606    0    0    1    0
>> 43    613    62    63    1    2
>> 43    614    613    615    1    2
>> 43    62    0    0    1    0
>> 43    63    0    0    2    2
>> 43    229    0    0    2    0
>> 43    616    613    615    2    2
>> 43    236    239    229    2    0
>> 43    239    0    0    1    2
>> 43    615    239    229    2    2
>> 43    617    239    229    2    2
>> 44    618    619    620    1    2
>> 44    621    619    620    1    0
>> 44    622    619    620    1    0
>> 44    623    0    0    2    0
>> 44    624    618    623    2    2
>> 44    625    618    623    1    0
>> 44    626    618    623    2    0
>> 44    627    619    620    2    0
>> 44    628    619    620    1    2
>> 44    629    619    620    2    2
>> 44    630    618    623    1    0
>> 44    631    618    623    1    0
>> 44    632    619    620    2    2
>> 44    633    618    623    2    0
>> 44    634    618    623    1    0
>> 44    619    0    0    1    0
>> 44    620    0    0    2    0
>> 45    635    636    637    1    0
>> 45    599    638    639    2    2
>> 45    640    638    639    1    0
>> 45    637    638    639    2    2
>> 45    641    636    637    2    2
>> 45    636    642    643    1    2
>> 45    644    636    637    1    2
>> 45    638    645    646    1    0
>> 45    647    636    637    1    2
>> 45    648    636    637    1    2
>> 45    649    636    637    1    2
>> 45    645    0    0    1    0
>> 45    650    0    0    1    0
>> 45    651    0    0    2    0
>> 45    643    0    0    2    0
>> 45    639    0    0    2    0
>> 45    642    650    651    1    0
>> 45    646    650    651    2    0
>> 46    652    653    654    2    2
>> 46    655    653    654    2    0
>> 46    656    653    654    2    2
>> 46    657    653    654    1    0
>> 46    654    0    0    2    0
>> 46    653    0    0    1    0
>> 47    95    0    0    2    0
>> 47    658    101    100    2    0
>> 47    99    659    660    1    2
>> 47    100    99    95    2    0
>> 47    661    659    660    1    0
>> 47    662    659    660    1    2
>> 47    663    659    660    2    2
>> 47    664    659    660    2    2
>> 47    665    101    100    2    0
>> 47    666    101    100    1    0
>> 47    93    101    100    2    0
>> 47    667    101    100    2    2
>> 47    101    0    0    1    0
>> 47    660    0    0    2    0
>> 47    659    0    0    1    0
>> 48    668    645    646    2    0
>> 48    669    645    646    1    2
>> 48    670    671    672    2    0
>> 48    673    669    670    2    2
>> 48    638    645    646    1    0
>> 48    674    645    646    2    0
>> 48    464    645    646    2    2
>> 48    675    645    646    1    0
>> 48    411    0    0    1    0
>> 48    645    0    0    1    0
>> 48    676    0    0    2    0
>> 48    650    0    0    1    0
>> 48    671    411    412    1    0
>> 48    677    0    0    1    0
>> 48    412    677    676    2    0
>> 48    651    677    676    2    0
>> 48    672    0    0    2    0
>> 48    646    650    651    2    0
>> 49    678    679    680    2    0
>> 49    681    679    680    1    0
>> 49    682    679    680    1    0
>> 49    683    0    0    1    0
>> 49    684    685    686    2    0
>> 49    687    0    0    2    0
>> 49    688    683    684    1    0
>> 49    689    690    691    2    2
>> 49    692    690    691    2    0
>> 49    693    690    691    2    0
>> 49    690    0    0    1    0
>> 49    694    679    680    1    0
>> 49    695    679    680    2    2
>> 49    696    679    680    1    0
>> 49    697    679    680    2    0
>> 49    686    0    0    2    0
>> 49    680    685    686    2    0
>> 49    679    0    0    1    0
>> 49    685    0    0    1    0
>> 49    691    688    687    2    0
>> 49    698    679    680    1    0
>> 49    699    679    680    2    0
>> 50    700    377    378    2    2
>> 50    701    702    703    1    0
>> 50    704    702    703    1    2
>> 50    705    702    703    1    2
>> 50    706    702    703    2    0
>> 50    707    704    708    2    2
>> 50    709    702    703    1    0
>> 50    702    710    711    1    2
>> 50    712    710    711    2    0
>> 50    713    710    711    2    0
>> 50    710    0    0    1    0
>> 50    711    0    0    2    0
>> 50    714    710    711    2    0
>> 50    715    710    711    1    0
>> 50    716    710    711    1    0
>> 50    717    710    711    2    0
>> 50    718    710    711    1    0
>> 50    719    720    700    2    0
>> 50    721    720    700    1    0
>> 50    708    720    700    2    2
>> 50    722    720    700    1    2
>> 50    703    0    0    2    2
>> 50    720    671    672    1    0
>> 50    411    0    0    1    0
>> 50    671    411    412    1    0
>> 50    378    411    412    2    0
>> 50    377    0    0    1    0
>> 50    412    0    0    2    0
>> 50    672    0    0    2    0
>> 51    723    724    725    2    0
>> 51    726    724    725    2    2
>> 51    727    724    725    2    2
>> 51    728    724    725    1    2
>> 51    725    0    0    2    0
>> 51    724    0    0    1    0
>> 51    653    724    725    1    0
>> 51    729    724    725    1    0
>> 52    730    0    0    1    0
>> 52    731    0    0    2    0
>> 52    732    733    734    1    0
>> 52    735    733    734    2    2
>> 52    736    733    734    2    2
>> 52    737    733    734    2    0
>> 52    738    733    734    2    0
>> 52    733    0    0    1    0
>> 52    739    730    731    1    0
>> 52    734    730    731    2    2
>> 52    740    730    731    2    2
>> 52    741    730    731    2    0
>> 52    742    730    731    2    0
>> 52    743    730    731    2    0
>> 52    744    730    731    1    0
>> 53    745    746    747    2    0
>> 53    746    0    0    1    0
>> 53    748    746    747    2    0
>> 53    749    746    747    2    2
>> 53    750    746    747    2    0
>> 53    751    752    753    1    0
>> 53    754    752    753    1    0
>> 53    755    746    747    2    0
>> 53    756    752    753    1    0
>> 53    435    746    747    2    2
>> 53    753    746    747    2    2
>> 53    757    746    747    2    0
>> 53    752    642    643    1    0
>> 53    758    752    753    2    2
>> 53    759    752    753    2    2
>> 53    760    0    0    2    0
>> 53    761    0    0    1    0
>> 53    762    650    760    2    0
>> 53    650    0    0    1    0
>> 53    651    0    0    2    0
>> 53    643    0    0    2    0
>> 53    747    761    762    2    0
>> 53    642    650    651    1    0
>> 54    763    0    0    2    0
>> 54    764    765    766    1    0
>> 54    767    765    766    2    0
>> 54    768    765    766    2    2
>> 54    769    685    686    1    0
>> 54    770    765    766    1    0
>> 54    771    765    766    2    2
>> 54    772    765    766    2    0
>> 54    773    765    766    1    2
>> 54    774    775    102    2    2
>> 54    765    776    763    1    0
>> 54    775    765    766    1    2
>> 54    766    769    777    2    0
>> 54    778    765    766    1    0
>> 54    777    0    0    2    0
>> 54    779    765    766    1    0
>> 54    780    765    766    1    0
>> 54    686    0    0    2    0
>> 54    102    0    0    2    0
>> 54    776    685    686    1    0
>> 54    685    0    0    1    0
>> 55    781    782    783    2    0
>> 55    221    782    783    2    0
>> 55    228    223    221    2    0
>> 55    784    785    228    2    0
>> 55    786    787    788    1    0
>> 55    787    789    790    1    0
>> 55    791    787    788    1    2
>> 55    785    0    0    1    0
>> 55    792    793    794    1    0
>> 55    790    793    794    2    0
>> 55    793    0    0    1    0
>> 55    101    785    228    1    0
>> 55    795    785    228    2    2
>> 55    794    0    0    2    0
>> 55    782    0    0    1    0
>> 55    789    0    0    1    0
>> 55    783    0    0    2    0
>> 55    223    0    0    1    0
>> 55    788    792    781    2    0
>> 55    796    785    228    1    0
>> 55    797    785    228    2    0
>> 55    798    785    228    1    0
>> 55    799    785    228    1    0
>> 55    800    785    228    1    0
>> 56    801    480    802    2    2
>> 56    803    480    802    1    0
>> 56    804    480    802    1    0
>> 56    480    0    0    1    2
>> 56    805    480    802    1    2
>> 56    806    0    0    2    0
>> 56    807    808    806    2    0
>> 56    809    480    802    1    0
>> 56    810    808    806    1    0
>> 56    802    808    806    2    2
>> 56    811    808    806    1    0
>> 56    808    0    0    1    0
>> 56    812    808    806    1    0
>> 56    813    808    806    2    0
>> 56    814    808    806    2    0
>> 56    815    808    806    2    0
>> 56    816    808    806    1    0
>> 57    817    818    819    1    0
>> 57    142    0    0    1    0
>> 57    819    142    161    2    0
>> 57    481    476    477    2    2
>> 57    382    818    819    1    0
>> 57    818    0    0    1    0
>> 57    820    818    819    1    0
>> 57    821    818    819    2    2
>> 57    822    818    819    2    2
>> 57    823    818    819    2    2
>> 57    824    818    819    1    0
>> 57    733    818    819    1    0
>> 57    825    818    819    1    0
>> 57    826    827    481    1    0
>> 57    828    818    819    1    0
>> 57    829    596    821    1    2
>> 57    830    596    821    1    2
>> 57    831    596    821    1    2
>> 57    596    0    0    1    2
>> 57    832    827    481    1    0
>> 57    833    827    481    1    2
>> 57    834    827    481    1    0
>> 57    835    827    481    2    0
>> 57    827    0    0    1    0
>> 57    161    0    0    2    0
>> 57    476    0    0    1    0
>> 57    477    142    161    2    0
>> 58    836    0    0    2    2
>> 58    837    696    836    2    0
>> 58    696    0    0    1    0
>> 58    838    696    836    1    2
>> 58    839    696    836    2    2
>> 59    840    841    674    2    0
>> 59    842    841    674    2    2
>> 59    843    841    674    1    0
>> 59    844    841    674    1    0
>> 59    845    841    674    1    0
>> 59    846    0    0    1    0
>> 59    847    846    848    2    0
>> 59    841    0    0    1    0
>> 59    627    619    620    2    0
>> 59    849    841    674    2    2
>> 59    850    841    674    1    2
>> 59    674    645    646    2    0
>> 59    851    850    852    1    2
>> 59    760    0    0    2    0
>> 59    853    850    852    1    2
>> 59    852    854    627    2    0
>> 59    854    0    0    1    0
>> 59    848    650    760    2    0
>> 59    645    0    0    1    0
>> 59    650    0    0    1    0
>> 59    855    856    847    1    2
>> 59    857    856    847    1    2
>> 59    858    856    847    2    2
>> 59    651    0    0    2    0
>> 59    856    0    0    1    0
>> 59    859    856    847    2    0
>> 59    619    650    651    1    0
>> 59    646    650    651    2    0
>> 59    620    0    0    2    0
>> 60    860    861    862    2    0
>> 60    863    864    865    1    0
>> 60    866    864    865    2    0
>> 60    867    864    865    2    0
>> 60    864    0    0    1    0
>> 60    868    0    0    1    0
>> 60    869    864    865    2    2
>> 60    870    864    865    1    0
>> 60    239    864    865    1    2
>> 60    871    864    865    2    0
>> 60    872    861    862    1    0
>> 60    873    861    862    2    0
>> 60    874    861    862    2    2
>> 60    875    868    876    2    0
>> 60    877    868    876    1    0
>> 60    878    0    0    1    0
>> 60    876    0    0    2    0
>> 60    879    0    0    2    0
>> 60    865    877    879    2    0
>> 60    862    0    0    2    0
>> 60    861    878    875    1    0
>> 61    880    881    882    2    0
>> 61    883    881    882    1    0
>> 61    884    881    882    2    0
>> 61    410    0    0    2    0
>> 61    881    0    0    1    0
>> 61    885    886    887    1    2
>> 61    888    886    887    2    0
>> 61    889    886    887    2    2
>> 61    886    0    0    1    0
>> 61    890    886    887    1    2
>> 61    882    0    0    2    0
>> 61    891    881    882    2    2
>> 61    892    881    882    2    2
>> 61    893    881    882    1    0
>> 61    894    881    882    1    0
>> 61    895    896    891    2    0
>> 61    897    896    891    2    2
>> 61    422    0    0    2    0
>> 61    896    898    899    1    0
>> 61    900    896    891    2    0
>> 61    426    0    0    1    0
>> 61    427    426    422    1    0
>> 61    898    0    0    1    0
>> 61    887    427    410    2    0
>> 61    901    886    887    2    0
>> 61    902    886    887    2    0
>> 61    899    426    422    2    0
>> 62    903    904    663    2    2
>> 62    904    0    0    1    0
>> 62    479    0    0    2    2
>> 62    905    906    483    2    0
>> 62    483    484    479    2    2
>> 62    484    0    0    1    2
>> 62    907    906    483    1    0
>> 62    663    0    0    2    2
>> 62    908    906    483    1    2
>> 62    909    910    903    1    2
>> 62    911    910    903    1    0
>> 62    910    912    913    1    2
>> 62    906    910    903    1    2
>> 62    913    0    0    2    2
>> 62    912    0    0    1    0
>> 63    914    915    916    2    2
>> 63    917    918    919    1    0
>> 63    919    31    29    2    0
>> 63    916    920    921    2    2
>> 63    922    920    921    1    0
>> 63    29    0    0    2    0
>> 63    923    924    925    2    0
>> 63    449    0    0    2    0
>> 63    545    924    925    2    2
>> 63    926    924    925    2    0
>> 63    918    0    0    1    0
>> 63    927    0    0    1    0
>> 63    31    450    449    1    0
>> 63    928    450    449    2    0
>> 63    450    0    0    1    0
>> 63    929    918    919    1    0
>> 63    920    0    0    1    0
>> 63    915    918    919    1    2
>> 63    930    918    919    1    0
>> 63    931    918    919    2    0
>> 63    932    915    916    1    0
>> 63    924    0    0    1    0
>> 63    925    927    928    2    0
>> 63    921    927    928    2    0
>> 63    933    924    925    2    0
>> 63    934    924    925    2    0
>> 63    935    924    925    1    0
>> 64    936    937    279    1    0
>> 64    938    937    279    1    0
>> 64    939    937    279    2    0
>> 64    937    0    0    1    0
>> 64    279    0    0    2    0
>> 64    177    0    0    2    0
>> 64    940    937    279    2    2
>> 64    342    937    279    2    2
>> 64    941    345    342    2    0
>> 64    942    345    342    1    0
>> 64    943    944    945    2    2
>> 64    946    947    948    2    2
>> 64    947    949    943    1    2
>> 64    950    947    948    2    2
>> 64    192    0    0    1    0
>> 64    949    192    177    1    0
>> 64    338    345    342    2    2
>> 64    951    345    342    1    0
>> 64    345    0    0    1    0
>> 64    952    345    342    2    0
>> 64    948    345    342    2    2
>> 64    953    345    342    1    0
>> 64    945    192    177    2    0
>> 64    944    0    0    1    0
>> 64    954    345    342    1    2
>> 65    955    944    945    2    0
>> 65    177    0    0    2    0
>> 65    956    949    943    2    0
>> 65    957    944    945    2    0
>> 65    543    944    945    1    2
>> 65    943    944    945    2    2
>> 65    958    944    945    1    0
>> 65    959    949    943    1    2
>> 65    947    949    943    1    2
>> 65    192    0    0    1    0
>> 65    949    192    177    1    0
>> 65    945    192    177    2    0
>> 65    960    949    943    1    0
>> 65    944    0    0    1    0
>> 66    410    0    0    2    0
>> 66    961    427    410    2    0
>> 66    333    427    410    2    2
>> 66    962    427    410    2    0
>> 66    427    0    0    1    0
>> 66    963    427    410    2    0
>> This is only a small portion of my pedigree file. In this pedigree list there are about 400 repeated id;  I want to replace repeated individual identifiers with new id and to replace them not only in id column but also in father and mother id columns. I don't want to remove subjects with the same id because they are useful for my heritability analysis. I use kinship package of R and it doesn't create a kinship matrix with repeated id.
>> Thank you for help
>> Best regards
>> Roberta
>>
>>                            
>>      [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>   		 	   		   		 	   		




More information about the R-help mailing list