Taking the mean of duplicate measurements of genes in a 50k gene data frame
Suppose you have measurements of 50001 gene samples, but some of them are duplicates. Taking the means of all those genes is trivial in R:
combined.samples <- aggregate(samples, by=list(aggregate$gene_id), FUN=mean)