[R] Crosstabs in R
Tan Hui Hui Jenny
medp9193 at nus.edu.sg
Tue Jun 28 03:13:11 CEST 2005
HI,
I have the data in the following format. My aim is to determine the concordance in genotype calls (SNP1, 2, 3,etc) at two centers.
DNA center snp1 snp2
NA07019 1 A A
NA07348 1 M G
NA10830 1 A G
NA10851 1 M G
NA10857 1 A G
NA10860 1 A G
NA10861 1 A G
NA12761 1 ? R
NA07019 2 A A
NA07348 2 M G
NA10830 2 A G
NA10851 2 M G
NA10857 2 A G
NA10860 2 A G
NA10861 2 A G
NA12761 2 A A
In SPSS, I would create individual crosstabulation tables and any positive integer values (counts) falling outside of the diagonal are disagreements in calls by the 2 centers (SNP2).
At SNP1, there are total of 7 genotype counts to compare (one DNA did not have genotype readout). And 7/7 are in agreement.
At SNP2, all 8 DNA samples were successfully typed by both centers. There is one discrepant call between centers.
Q1: how do I create the same crosstabs in R?
Eventually, I would summarize the data as follows:
SNP N_to_compare N_agreement %Concordance
snp1 7 7 100
snp2 8 7 87.5
etc
Q2: From the individual crosstabs tables, can I automatically extract those numbers in columns 2 and 3?
rgds,
jenny
More information about the R-help
mailing list