I have a matrix like following

> test=matrix(c(1:15),nrow=3,ncol=5)
> colnames(test)=c("A","A","B","B","B")
> test
     A A B  B  B
[1,] 1 4 7 10 13
[2,] 2 5 8 11 14
[3,] 3 6 9 12 15

I want to calculate the average of each replicates, ie. I want the output to
be
     A B
[1,] 2.5 10
[2,] 3.5 11
[3,] 4.5 12

I can do this by looping through each level of the column name, but I was
wondering if there is a function for calculating the average of replicates
in one step.

Thank you in advance.
Wendy

	[[alternative HTML version deleted]]

