Hello, I have a data frame as following
Marker Allele_A Allele_B Line1 Line2 Line3 Line4
1 C G C C C G
2 A T A T T T
3 G C G G G C
I would like to count the number of Allele_A and Allele_B appears among Line1-4 in each row and get the following results:
Marker Allele_A Allele_B Line1 Line2 Line3 Line4 Allele_A# Allele_B#
1 C G C C C G 3 1
2 A T A T T T 1 3
3 G C G G G C 3 1
I tried different codes and all failed. Could anyone help me to solve this problem? Thanks a lot!