I'm working with genotype data in a frequency table:

> a=matrix(1:16, nrow=4)
> rownames(a)=c("AA","AT","TA","TT")
> a
   [,1] [,2] [,3] [,4]
AA    1    5    9   13
AT    2    6   10   14
TA    3    7   11   15
TT    4    8   12   16

'AT' and 'TA' are essentially the same, and I'd like to combine (add) the rows 
to reflect this. The final matrix should be:

   [,1] [,2] [,3] [,4]
AA    1    5    9   13
AT    5    13   21   29
TT    4    8   12   16

Is there a fast way to do this?

Thanks in advance!

Jacy Crosby
jacy.r.cro...@uth.tmc.edu


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to