Hi to all
i have data like this
df <- read.delim(sep="|", text=c("
M1 M2
A/A G/G
T/T NA
NA C/C
A/A G/G
A/A A/A
"))
now I would like to match row1 of M1 column with itself and with other rows of the same column (iterative matching) if it matches then 0 otherwise 1 but any row of M1 column has NA I do not want include that row in matches and I do not match this row with other rows of M1 column and I would like to repeat this with M2 column too and finally I will sum column at bottom (6 for M1 and 10 for M2). any help in this regard is highly appreciated
finally my results looks like this
M1 M2
0 0
1 0
0 1
0 0
0 1
1 0
0 0
0 0
1 0
1 0
0 1
0 0
0 0
0 1
0 1
0 0
1 0
0 1
0 0
0 1
0 1
1 0
0 1
0 1
0 0
6 10
Thanks in advance
Genetist