This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sum Common Lines

What is the quickest way to sum up columns that have the common name

Example

3   A
2   A
1   B
2   C
9   C
1   C

So that i will get

A   5
B   1
C   12

In R or unix or perl

unix perl r
  awk '{a[$2]+=int($1);} END{ for(i in a) print i,a[i];}'

your question is not related to bioinformatics. It will be closed.

0 answers

No answers yet.

Log in to answer this question.